Skip to content

Commit

Permalink
ci: automatically update homebrew tap on release
Browse files Browse the repository at this point in the history
Use a workflow dispatch to update the version in the homebrew
tap (https://github.com/derlin/homebrew-bitdowntoc) upon release.

This is made possible thanks to a manually triggered workflow on
the tap repository.
  • Loading branch information
derlin committed Apr 28, 2024
1 parent 11c0525 commit 7f7bcb7
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ name: Build
on:
push:
branches:
- '**' # all branches
- '!main' # except main
- 'asdf'

jobs:
build:
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,19 @@ jobs:
uses: ./.github/workflows/native_reusable.yml
with:
tag_name: ${{ needs.release-please.outputs.tag_name }}

update_homebrew:
runs-on: ubuntu-latest
needs: [ release-please, upload-jar ]
steps:
- name: trigger homebrew update
# The PAT should have actions:read-write
run: |
curl -L \
-X POST \
--fail-with-body \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.HOMEBREW_PAT }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/derlin/homebrew-bitdowntoc/actions/workflows/${{ secrets.HOMEBREW_WORKFLOW_ID }}/dispatches \
-d '{"ref":"main","inputs":{}}'
20 changes: 20 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: test
on:
push:
branches:
- update-homebrew

jobs:
update_homebrew:
runs-on: ubuntu-latest
steps:
- name: trigger homebrew update
run: |
curl -L \
--fail-with-body \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.HOMEBREW_PAT }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/derlin/homebrew-bitdowntoc/actions/workflows/${{ secrets.HOMEBREW_WORKFLOW_ID }}/dispatches \
-d '{"ref":"main","inputs":{}}'

0 comments on commit 7f7bcb7

Please sign in to comment.