diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c063b14..e5c27db 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -140,19 +140,14 @@ jobs: TAG: ${{ needs.build.outputs.tag }} run: gh release create "$TAG" dist/* --verify-tag --generate-notes --title "$TAG" - tap: - name: Test formula and update Homebrew tap + formula-test: + name: Test formula on arm64 if: github.event_name == 'push' needs: - build - release runs-on: macos-15 timeout-minutes: 20 - # The environment only admits v*.*.* tags, which scopes the tap token to releases. - environment: homebrew-tap - concurrency: - group: homebrew-tap-gbat - cancel-in-progress: false env: TAG: ${{ needs.build.outputs.tag }} VERSION: ${{ needs.build.outputs.version }} @@ -189,7 +184,6 @@ jobs: end EOF - # Runs before the tap checkout so no Homebrew step can read the tap token. - name: Install and test formula run: | set -euo pipefail @@ -202,6 +196,30 @@ jobs: brew install softmaxe/release-test/gbat brew test softmaxe/release-test/gbat + - name: Upload tested formula + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: homebrew-formula + path: ${{ runner.temp }}/gbat.rb + if-no-files-found: error + retention-days: 30 + + tap-sync: + name: Update Homebrew tap + if: github.event_name == 'push' + needs: + - build + - formula-test + runs-on: ubuntu-24.04 + timeout-minutes: 10 + # The environment only admits v*.*.* tags, which scopes the tap token to releases. + environment: homebrew-tap + concurrency: + group: homebrew-tap-gbat + cancel-in-progress: false + env: + VERSION: ${{ needs.build.outputs.version }} + steps: - name: Check out Homebrew tap uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: @@ -210,6 +228,12 @@ jobs: path: homebrew-tap token: ${{ secrets.HOMEBREW_TAP_TOKEN }} + - name: Download tested formula + uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 + with: + name: homebrew-formula + path: ${{ runner.temp }}/formula + - name: Commit and push formula working-directory: homebrew-tap run: | @@ -227,11 +251,13 @@ jobs: fi fi - install -m 0644 "$RUNNER_TEMP/gbat.rb" Formula/gbat.rb + install -m 0644 "$RUNNER_TEMP/formula/gbat.rb" Formula/gbat.rb git add Formula/gbat.rb if git diff --cached --quiet; then echo "Formula/gbat.rb is already current" exit 0 fi + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" git commit -m "chore: update gbat to $VERSION" git push origin HEAD:main