feat(ci): support manual trigger to release #8
Workflow file for this run
This file contains hidden or 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: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| name: Build ${{ matrix.target }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| include: | |
| # macOS (ARM) — primary platform | |
| - target: aarch64-apple-darwin | |
| os: macos-latest | |
| binary: boxrun | |
| archive: boxrun-aarch64-darwin.tar.gz | |
| guest_target: aarch64-unknown-linux-musl | |
| # macOS (amd64) | |
| - target: x86_64-apple-darwin | |
| os: macos-13 | |
| binary: boxrun | |
| archive: boxrun-x86_64-darwin.tar.gz | |
| guest_target: x86_64-unknown-linux-musl | |
| # Linux (amd64) | |
| - target: x86_64-unknown-linux-gnu | |
| os: ubuntu-latest | |
| binary: boxrun | |
| archive: boxrun-x86_64-linux.tar.gz | |
| guest_target: x86_64-unknown-linux-musl | |
| # Linux (arm64) | |
| - target: aarch64-unknown-linux-gnu | |
| os: ubuntu-24.04-arm | |
| binary: boxrun | |
| archive: boxrun-aarch64-linux.tar.gz | |
| guest_target: aarch64-unknown-linux-musl | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Check out BoxLite | |
| run: git clone --recurse-submodules --depth 1 https://github.com/boxlite-ai/boxlite.git ../boxlite | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: | | |
| ${{ matrix.target }} | |
| ${{ matrix.guest_target }} | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Install Go (for libgvproxy) | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.22' | |
| - name: Install build dependencies (macOS) | |
| if: runner.os == 'macOS' | |
| run: | | |
| brew install llvm lld protobuf | |
| brew install messense/macos-cross-toolchains/aarch64-unknown-linux-musl | |
| - name: Install build dependencies (Linux) | |
| if: runner.os == 'Linux' | |
| env: | |
| SKIP_INSTALL_NODEJS: '1' | |
| run: bash ../boxlite/scripts/setup/setup-ubuntu.sh | |
| - name: Build release binary | |
| run: cargo build --release --bin boxrun --target ${{ matrix.target }} | |
| - name: Build BoxLite runtime | |
| run: | | |
| export GUEST_TARGET="${{ matrix.guest_target }}" | |
| LIBS_DIR=$(find "$PWD/target/${{ matrix.target }}/release/build" -path "*/boxlite-*/out/runtime" -type d | head -1) | |
| bash ../boxlite/scripts/build/build-runtime.sh \ | |
| --dest-dir "$PWD/target/boxlite-runtime" \ | |
| --libs-dir "$LIBS_DIR" | |
| - name: Package archive | |
| run: | | |
| mkdir -p staging/boxrun/runtime | |
| cp target/${{ matrix.target }}/release/${{ matrix.binary }} staging/boxrun/ | |
| if [ "${{ runner.os }}" = "macOS" ]; then | |
| install_name_tool -add_rpath @executable_path/runtime staging/boxrun/${{ matrix.binary }} | |
| else | |
| patchelf --set-rpath '$ORIGIN/runtime' staging/boxrun/${{ matrix.binary }} | |
| fi | |
| cp target/boxlite-runtime/* staging/boxrun/runtime/ | |
| echo "=== Contents ===" | |
| ls -lh staging/boxrun/ | |
| ls -lh staging/boxrun/runtime/ | |
| cd staging | |
| tar czf ../${{ matrix.archive }} boxrun | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.archive }} | |
| path: ${{ matrix.archive }} | |
| release: | |
| name: Create Release | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| merge-multiple: true | |
| - name: Generate checksums | |
| run: shasum -a 256 *.tar.gz > checksums.txt | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: | | |
| boxrun-aarch64-darwin.tar.gz | |
| boxrun-x86_64-darwin.tar.gz | |
| boxrun-x86_64-linux.tar.gz | |
| boxrun-aarch64-linux.tar.gz | |
| checksums.txt | |
| generate_release_notes: true |