Publish #27
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish | |
# Controls when the action will run. Workflow runs when manually triggered using the UI | |
# or API. | |
on: | |
workflow_call: | |
secrets: | |
PREFIX_API_KEY: | |
required: true | |
workflow_dispatch: | |
inputs: | |
run_mac: | |
# Friendly description to be shown in the UI instead of 'name' | |
description: 'Enable MacOS deployment' | |
# Default value if no value is explicitly provided | |
default: false | |
# Input has to be provided for the workflow to run | |
required: true | |
# The data type of the input | |
type: boolean | |
jobs: | |
publish: | |
strategy: | |
matrix: | |
include: | |
- { target: linux-64, os: ubuntu-latest } | |
# - { target: osx-arm64, os: macos-14 } | |
fail-fast: false | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 10 | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Publish package to prefix.dev | |
env: | |
TARGET_PLATFORM: ${{ matrix.target }} | |
PREFIX_API_KEY: ${{ secrets.PREFIX_API_KEY }} | |
run: | | |
if [[ github.event.inputs.run_mac == 'false' ]]; then | |
echo "Mac build disabled, exiting..." | |
exit 0 | |
fi | |
curl -ssL https://magic.modular.com | bash | |
source $HOME/.bash_profile | |
# Temporary method to fetch the rattler binary. | |
RATTLER_BINARY="rattler-build-aarch64-apple-darwin" | |
if [[ $TARGET_PLATFORM == "linux-64" ]]; then | |
RATTLER_BINARY="rattler-build-x86_64-unknown-linux-musl"; | |
curl -SL --progress-bar https://github.com/prefix-dev/rattler-build/releases/latest/download/${RATTLER_BINARY} -o rattler-build || exit 1 | |
chmod +x rattler-build | |
else | |
brew install rattler-build | |
fi | |
magic run publish || exit 1 |