Release Binaries #6
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 Binaries | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: 'Release tag to build binaries for (e.g., v0.6.11.2)' | |
| required: true | |
| type: string | |
| env: | |
| CARGO_INCREMENTAL: 0 | |
| CARGO_NET_RETRY: 10 | |
| RUST_BACKTRACE: short | |
| RUSTUP_MAX_RETRIES: 10 | |
| jobs: | |
| build-macos: | |
| name: Build aarch64-apple-darwin | |
| runs-on: namespace-profile-gitar-macos | |
| steps: | |
| - name: Checkout repository | |
| uses: namespacelabs/nscloud-checkout-action@v8 | |
| with: | |
| ref: ${{ inputs.tag }} | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache Dependencies | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Build | |
| run: cargo build --release --package prisma-cli | |
| - name: Create zip | |
| run: | | |
| cd target/release | |
| mv prisma prisma-cli-aarch64-apple-darwin | |
| zip prisma-cli-aarch64-apple-darwin.zip prisma-cli-aarch64-apple-darwin | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: prisma-cli-aarch64-apple-darwin | |
| path: target/release/prisma-cli-aarch64-apple-darwin.zip | |
| build-linux-x86: | |
| name: Build x86_64-unknown-linux-gnu | |
| runs-on: namespace-profile-gitar | |
| steps: | |
| - name: Checkout repository | |
| uses: namespacelabs/nscloud-checkout-action@v8 | |
| with: | |
| ref: ${{ inputs.tag }} | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache Dependencies | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Build | |
| run: cargo build --release --package prisma-cli | |
| - name: Create zip | |
| run: | | |
| cd target/release | |
| mv prisma prisma-cli-x86_64-unknown-linux-gnu | |
| zip prisma-cli-x86_64-unknown-linux-gnu.zip prisma-cli-x86_64-unknown-linux-gnu | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: prisma-cli-x86_64-unknown-linux-gnu | |
| path: target/release/prisma-cli-x86_64-unknown-linux-gnu.zip | |
| build-linux-arm: | |
| name: Build aarch64-unknown-linux-gnu | |
| runs-on: namespace-profile-gitar | |
| steps: | |
| - name: Checkout repository | |
| uses: namespacelabs/nscloud-checkout-action@v8 | |
| with: | |
| ref: ${{ inputs.tag }} | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: aarch64-unknown-linux-gnu | |
| - name: Install Zig | |
| uses: goto-bus-stop/setup-zig@v2 | |
| with: | |
| version: 0.13.0 | |
| - name: Install cargo-zigbuild | |
| run: cargo install cargo-zigbuild | |
| - name: Cache Dependencies | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| key: aarch64-unknown-linux-gnu | |
| - name: Build with zigbuild | |
| run: cargo zigbuild --release --package prisma-cli --target aarch64-unknown-linux-gnu | |
| - name: Create zip | |
| run: | | |
| cd target/aarch64-unknown-linux-gnu/release | |
| mv prisma prisma-cli-aarch64-unknown-linux-gnu | |
| zip prisma-cli-aarch64-unknown-linux-gnu.zip prisma-cli-aarch64-unknown-linux-gnu | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: prisma-cli-aarch64-unknown-linux-gnu | |
| path: target/aarch64-unknown-linux-gnu/release/prisma-cli-aarch64-unknown-linux-gnu.zip | |
| upload-release: | |
| name: Upload to Release | |
| needs: [build-macos, build-linux-x86, build-linux-arm] | |
| runs-on: namespace-profile-gitar-small | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Display structure of downloaded files | |
| run: find artifacts -type f -name "*.zip" | |
| - name: Upload release assets | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| for zip in $(find artifacts -type f -name "*.zip"); do | |
| echo "Uploading $zip" | |
| gh release upload ${{ inputs.tag }} "$zip" --repo ${{ github.repository }} --clobber | |
| done |