Gateway: 0.1.318 #431
Workflow file for this run
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: Build and release CLI | |
on: | |
release: | |
types: [created] | |
workflow_dispatch: | |
inputs: | |
app_version: | |
description: Semantic version of release | |
required: true | |
type: string | |
permissions: | |
actions: write | |
contents: write | |
jobs: | |
build: | |
if: (github.event_name == 'release' && startsWith(github.ref_name, 'cli-')) || inputs.app_version != '' | |
name: build (${{ matrix.platform.target_alt }}) | |
timeout-minutes: 5 | |
outputs: | |
app_version: ${{ steps.set-build-info.outputs.app_version }} | |
strategy: | |
matrix: | |
platform: | |
- os: macos-latest | |
target: aarch64-apple-darwin | |
target_alt: darwin-arm64 | |
bin_name: beta9 | |
- os: macos-latest | |
target: x86_64-apple-darwin | |
target_alt: darwin-amd64 | |
bin_name: beta9 | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
target_alt: linux-amd64 | |
bin_name: beta9 | |
- os: ubuntu-latest | |
target: aarch64-unknown-linux-gnu | |
target_alt: linux-arm64 | |
bin_name: beta9 | |
runs-on: ${{ matrix.platform.os }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set build info | |
id: set-build-info | |
run: | | |
if [[ ! -z "${{ inputs.app_version }}" ]]; then | |
echo "app_version=${{ inputs.app_version }}" >> $GITHUB_OUTPUT | |
else | |
echo "app_version=${GITHUB_REF_NAME#cli-}" >> $GITHUB_OUTPUT | |
fi | |
- name: Setup Rust | |
uses: moonrepo/setup-rust@v1 | |
with: | |
targets: "${{ matrix.platform.target }}" | |
- name: Setup PyApp | |
env: | |
PYAPP_VERSION: 0.22.0 | |
run: | | |
curl -L -o pyapp.tar.gz https://github.com/ofek/pyapp/releases/download/v${PYAPP_VERSION}/source.tar.gz | |
tar -xzf pyapp.tar.gz | |
mv pyapp-v* pyapp-latest | |
- name: Build binary | |
uses: houseabsolute/actions-rust-cross@v0.0.13 | |
env: | |
PYAPP_PROJECT_NAME: "beta9" | |
PYAPP_PROJECT_VERSION: "${{ steps.set-build-info.outputs.app_version }}" | |
PYAPP_FULL_ISOLATION: "true" | |
PYAPP_DISTRIBUTION_EMBED: "true" | |
with: | |
command: "build" | |
args: "--release --locked" | |
target: "${{ matrix.platform.target }}" | |
strip: true | |
working-directory: pyapp-latest | |
- name: Prepare artifact | |
id: prepare-artifact | |
env: | |
GZIP: "-9" | |
run: | | |
mv -v pyapp-latest/target/${{ matrix.platform.target }}/release/pyapp pyapp-latest/target/${{ matrix.platform.target }}/release/${{ matrix.platform.bin_name }} | |
cp -v pyapp-latest/target/${{ matrix.platform.target }}/release/${{ matrix.platform.bin_name }} . | |
tar -cvzf ${{ matrix.platform.bin_name }}-${{ steps.set-build-info.outputs.app_version }}-${{ matrix.platform.target_alt }}.tar.gz ${{ matrix.platform.bin_name }} | |
echo "tar_file_path=$(pwd)/${{ matrix.platform.bin_name }}-${{ steps.set-build-info.outputs.app_version }}-${{ matrix.platform.target_alt }}.tar.gz" >> $GITHUB_OUTPUT | |
- name: Upload artifact to actions run | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.platform.bin_name }}-${{ steps.set-build-info.outputs.app_version }}-${{ matrix.platform.target_alt }} | |
path: ${{ matrix.platform.bin_name }} | |
if-no-files-found: ignore | |
compression-level: "9" | |
- name: Upload artifact to release | |
if: github.event_name == 'release' && startsWith(github.ref_name, 'cli-') | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
gh release upload ${GITHUB_REF_NAME} "${{ steps.prepare-artifact.outputs.tar_file_path }}" | |
formula: | |
if: github.event_name == 'release' && startsWith(github.ref_name, 'cli-') | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Send update formula event | |
uses: peter-evans/repository-dispatch@v3 | |
with: | |
token: ${{ secrets.DISPATCH_TO_HOMEBREW_BEAM_GH_TOKEN }} | |
repository: beam-cloud/homebrew-beam | |
event-type: update-formula | |
client-payload: |- | |
{ | |
"name": "Beta9", | |
"version": "${{ needs.build.outputs.app_version }}", | |
"tag": "${{ github.ref_name }}", | |
"repo": "${{ github.repository }}" | |
} |