@@ -278,61 +278,29 @@ jobs:
278278
279279 gh release create "${{ needs.plan.outputs.tag }}" --target "$RELEASE_COMMIT" $PRERELEASE_FLAG --title "$ANNOUNCEMENT_TITLE" --notes-file "$RUNNER_TEMP/notes.txt" artifacts/*
280280
281- publish-homebrew-formula :
281+ custom- publish-homebrew :
282282 needs :
283283 - plan
284284 - host
285- runs-on : " ubuntu-22.04"
286- env :
287- GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
288- PLAN : ${{ needs.plan.outputs.val }}
289- GITHUB_USER : " axo bot"
290- GITHUB_EMAIL : " admin+bot@axo.dev"
291285 if : ${{ !fromJson(needs.plan.outputs.val).announcement_is_prerelease || fromJson(needs.plan.outputs.val).publish_prereleases }}
292- steps :
293- - uses : actions/checkout@v6
294- with :
295- persist-credentials : true
296- repository : " hotdata-dev/homebrew-tap"
297- token : ${{ secrets.HOMEBREW_TAP_TOKEN }}
298- # So we have access to the formula
299- - name : Fetch homebrew formulae
300- uses : actions/download-artifact@v7
301- with :
302- pattern : artifacts-*
303- path : Formula/
304- merge-multiple : true
305- # This is extra complex because you can make your Formula name not match your app name
306- # so we need to find releases with a *.rb file, and publish with that filename.
307- - name : Commit formula files
308- run : |
309- git config --global user.name "${GITHUB_USER}"
310- git config --global user.email "${GITHUB_EMAIL}"
311-
312- for release in $(echo "$PLAN" | jq --compact-output '.releases[] | select([.artifacts[] | endswith(".rb")] | any)'); do
313- filename=$(echo "$release" | jq '.artifacts[] | select(endswith(".rb"))' --raw-output)
314- name=$(echo "$filename" | sed "s/\.rb$//")
315- version=$(echo "$release" | jq .app_version --raw-output)
316-
317- export PATH="/home/linuxbrew/.linuxbrew/bin:$PATH"
318- brew update
319- # We avoid reformatting user-provided data such as the app description and homepage.
320- brew style --except-cops FormulaAudit/Homepage,FormulaAudit/Desc,FormulaAuditStrict --fix "Formula/${filename}" || true
321-
322- git add "Formula/${filename}"
323- git commit -m "${name} ${version}"
324- done
325- git push
286+ uses : ./.github/workflows/publish-homebrew.yml
287+ with :
288+ plan : ${{ needs.plan.outputs.val }}
289+ secrets : inherit
290+ # publish jobs get escalated permissions
291+ permissions :
292+ " id-token " : " write"
293+ " packages " : " write"
326294
327295 announce :
328296 needs :
329297 - plan
330298 - host
331- - publish-homebrew-formula
299+ - custom- publish-homebrew
332300 # use "always() && ..." to allow us to wait for all publish jobs while
333301 # still allowing individual publish jobs to skip themselves (for prereleases).
334302 # "host" however must run to completion, no skipping allowed!
335- if : ${{ always() && needs.host.result == 'success' && (needs.publish-homebrew-formula .result == 'skipped' || needs.publish-homebrew-formula .result == 'success') }}
303+ if : ${{ always() && needs.host.result == 'success' && (needs.custom- publish-homebrew.result == 'skipped' || needs.custom- publish-homebrew.result == 'success') }}
336304 runs-on : " ubuntu-22.04"
337305 env :
338306 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments