v2.0.1-fix #16
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: Build and Upload Binaries | |
| on: | |
| release: | |
| types: [published] | |
| jobs: | |
| build-and-upload: | |
| name: Build binaries for release | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| include: | |
| - os: macos-15-intel | |
| target: x86_64-apple-darwin | |
| - os: macos-latest | |
| target: aarch64-apple-darwin | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| steps: | |
| - name: Checkout source | |
| uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Build release binary | |
| run: cargo build --release --target ${{ matrix.target }} | |
| - name: Package as ZIP | |
| run: | | |
| mkdir -p dist | |
| cd target/${{ matrix.target }}/release | |
| zip -r ../../../dist/gamba-${{ matrix.target }}.zip gamba | |
| cd - | |
| - name: Upload ZIP to existing GitHub release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: dist/*.zip | |
| token: ${{ secrets.GAMBA_GITHUB_TOKEN }} | |
| update-homebrew: | |
| name: Update Homebrew formula | |
| runs-on: ubuntu-latest | |
| needs: build-and-upload | |
| steps: | |
| - name: Checkout gamba-tool | |
| uses: actions/checkout@v4 | |
| - name: Clone homebrew tap | |
| run: | | |
| git clone https://github.com/nurie05/homebrew-tools.git tap | |
| - name: Update formula with new release info | |
| run: | | |
| VERSION="${GITHUB_REF#refs/tags/v}" | |
| FORMULA="tap/Formula/gamba.rb" | |
| REPO="${{ github.repository }}" | |
| BASE_URL="https://github.com/$REPO/releases/download/v$VERSION" | |
| echo "Downloading binaries to compute SHA256s..." | |
| curl -L "$BASE_URL/gamba-aarch64-apple-darwin.zip" -o arm_mac.zip | |
| curl -L "$BASE_URL/gamba-x86_64-apple-darwin.zip" -o intel_mac.zip | |
| curl -L "$BASE_URL/gamba-x86_64-unknown-linux-gnu.zip" -o linux_x86.zip | |
| curl -L "$BASE_URL/gamba-aarch64-unknown-linux-gnu.zip" -o linux_arm.zip | |
| ARM_MAC_SHA=$(shasum -a 256 arm_mac.zip | cut -d ' ' -f1) | |
| INTEL_MAC_SHA=$(shasum -a 256 intel_mac.zip | cut -d ' ' -f1) | |
| LINUX_X86_SHA=$(shasum -a 256 linux_x86.zip | cut -d ' ' -f1) | |
| LINUX_ARM_SHA=$(shasum -a 256 linux_arm.zip | cut -d ' ' -f1) | |
| echo "Updating $FORMULA..." | |
| sed -i "s|version \".*\"|version \"$VERSION\"|" "$FORMULA" | |
| sed -i "s|url \".*aarch64-apple-darwin.zip\"|url \"$BASE_URL/gamba-aarch64-apple-darwin.zip\"|" "$FORMULA" | |
| sed -i -E "s|^[[:space:]]*sha256[[:space:]]+\"[^\"]+\"[[:space:]]+# arm64$| sha256 \"$ARM_MAC_SHA\" # arm64|" "$FORMULA" | |
| sed -i "s|url \".*x86_64-apple-darwin.zip\"|url \"$BASE_URL/gamba-x86_64-apple-darwin.zip\"|" "$FORMULA" | |
| sed -i -E "s|^[[:space:]]*sha256[[:space:]]+\"[^\"]+\"[[:space:]]+# intel$| sha256 \"$INTEL_MAC_SHA\" # intel|" "$FORMULA" | |
| sed -i "s|url \".*x86_64-unknown-linux-gnu.zip\"|url \"$BASE_URL/gamba-x86_64-unknown-linux-gnu.zip\"|" "$FORMULA" | |
| sed -i -E "s|^[[:space:]]*sha256[[:space:]]+\"[^\"]+\"[[:space:]]+# linux-x86$| sha256 \"$LINUX_X86_SHA\" # linux-x86|" "$FORMULA" | |
| sed -i "s|url \".*aarch64-unknown-linux-gnu.zip\"|url \"$BASE_URL/gamba-aarch64-unknown-linux-gnu.zip\"|" "$FORMULA" | |
| sed -i -E "s|^[[:space:]]*sha256[[:space:]]+\"[^\"]+\"[[:space:]]+# linux-arm$| sha256 \"$LINUX_ARM_SHA\" # linux-arm|" "$FORMULA" | |
| - name: Commit and push updated formula | |
| run: | | |
| cd tap | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add Formula/gamba.rb | |
| cat Formula/gamba.rb | |
| git commit -m "Update gamba formula to v${GITHUB_REF#refs/tags/v}" | |
| git push https://nurie05:${{ secrets.GAMBA_GITHUB_TOKEN }}@github.com/nurie05/homebrew-tools.git HEAD:main |