Skip to content

Commit e3fbfbd

Browse files
authored
Release workflow: Allow manual trigger, use aarch64 for macos (#123)
Release workflow was failing to compile and upload binaries. Changes: - Use ARM, since this is what most people use now on MacOS - Allow manual triggering of workflow, so we can attach binaries to the existing v0.9.0 release - Install required dependencies
1 parent 4c5d992 commit e3fbfbd

File tree

1 file changed

+26
-3
lines changed

1 file changed

+26
-3
lines changed

.github/workflows/build-release-binaries.yaml

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,20 @@ on:
44
release:
55
types:
66
- created
7+
workflow_dispatch:
8+
inputs:
9+
release_tag:
10+
description: 'Release tag to attach binaries to (e.g., v0.9.0)'
11+
required: true
12+
type: string
713

814
jobs:
915
build_and_upload:
1016
strategy:
1117
matrix:
1218
platform:
1319
- { os: ubuntu-latest, target: x86_64-unknown-linux-musl }
14-
- { os: macos-latest, target: x86_64-apple-darwin }
20+
- { os: macos-latest, target: aarch64-apple-darwin }
1521

1622
runs-on: ${{ matrix.platform.os }}
1723

@@ -34,7 +40,7 @@ jobs:
3440

3541
- name: Add apple target
3642
if: matrix.platform.os == 'macos-latest'
37-
run: rustup target add x86_64-apple-darwin
43+
run: rustup target add aarch64-apple-darwin
3844

3945
- name: Add musl target
4046
if: matrix.platform.os == 'ubuntu-latest'
@@ -47,13 +53,30 @@ jobs:
4753
sudo apt-get install -y musl-tools clang build-essential curl llvm-dev libclang-dev linux-headers-generic libsnappy-dev liblz4-dev libzstd-dev libgflags-dev zlib1g-dev libbz2-dev
4854
sudo ln -s /usr/bin/g++ /usr/bin/musl-g++
4955
56+
- name: Install deps for macOS build
57+
if: matrix.platform.os == 'macos-latest'
58+
run: |
59+
brew install llvm
60+
echo "LIBCLANG_PATH=$(brew --prefix llvm)/lib" >> $GITHUB_ENV
61+
env:
62+
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
63+
5064
- name: Build Rust project
5165
run: cargo build --release --target ${{ matrix.platform.target }}
5266

67+
- name: Get release upload URL
68+
id: get_release
69+
if: github.event_name == 'workflow_dispatch'
70+
run: |
71+
UPLOAD_URL=$(gh api repos/${{ github.repository }}/releases/tags/${{ inputs.release_tag }} --jq '.upload_url')
72+
echo "upload_url=$UPLOAD_URL" >> $GITHUB_OUTPUT
73+
env:
74+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
75+
5376
- name: Upload Binary to Release
5477
uses: actions/upload-release-asset@v1
5578
with:
56-
upload_url: ${{ github.event.release.upload_url }}
79+
upload_url: ${{ github.event.release.upload_url || steps.get_release.outputs.upload_url }}
5780
asset_path: ./target/${{ matrix.platform.target }}/release/try-runtime
5881
asset_name: try-runtime-${{ matrix.platform.target }}
5982
asset_content_type: application/octet-stream

0 commit comments

Comments
 (0)