11name : Update Homebrew Formula on Release
22
3- # Triggers when a new version tag is pushed
3+ # Triggers when a release is published. Not `push: tags`, which GitHub skips
4+ # when the tagged commit message carries [skip ci] -- that silently dropped the
5+ # v5.6.0 and v5.7.0 formula updates, while docker.yml fired for both because a
6+ # release event is not a push event.
47on :
5- push :
6- tags :
7- - ' v*'
8+ release :
9+ types : [published]
810 pull_request :
911 branches : [master]
1012 paths :
@@ -28,6 +30,9 @@ permissions:
2830jobs :
2931 update-homebrew-tap :
3032 name : Update homebrew-mfc tap
33+ # A prerelease tag (v5.8.0-rc1) would fail the X.Y.Z check below, so skip it
34+ # rather than reporting a red release job.
35+ if : ${{ github.event_name != 'release' || !github.event.release.prerelease }}
3136 runs-on : ubuntu-latest
3237 environment :
3338 name : homebrew
4449 VERSION="5.2.0"
4550 echo "::notice::PR test mode - using version $VERSION"
4651 else
47- # Extract version from tag (remove 'v' prefix)
48- VERSION="${GITHUB_REF#refs/tags/v}"
52+ # Extract version from the released tag (remove 'v' prefix)
53+ VERSION="${{ github.event.release.tag_name }}"
54+ VERSION="${VERSION#v}"
4955 fi
5056
5157 if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
97103 echo "- Update formula" >> $GITHUB_STEP_SUMMARY
98104 echo "- Push to tap" >> $GITHUB_STEP_SUMMARY
99105 echo "" >> $GITHUB_STEP_SUMMARY
100- echo "The full workflow will run when a \`v*\` tag is pushed after merge." >> $GITHUB_STEP_SUMMARY
106+ echo "The full workflow will run when a release is published after merge." >> $GITHUB_STEP_SUMMARY
101107
102108 - name : Checkout homebrew-mfc tap
103109 if : ${{ github.event_name != 'pull_request' }}
0 commit comments