-
-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (72 loc) · 2.85 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: Bump Homebrew formula
on:
repository_dispatch:
types: [update-formula]
workflow_dispatch:
inputs:
formula_previous_version:
description: "Previous version of the formula"
required: true
type: string
formula_new_version:
description: "New version of the formula"
required: true
type: string
formula_name:
description: "Name of the formula"
required: true
type: string
formula_url:
description: "URL of the formula"
required: true
type: string
formula_homebrew_tap:
description: "Homebrew tap"
required: true
type: string
env:
COMMITTER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
FORMULA_PREVIOUS_VERSION: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.formula_previous_version || inputs.formula_previous_version }}
FORMULA_NEW_VERSION: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.formula_new_version || inputs.formula_new_version }}
FORMULA_NAME: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.formula_name || inputs.formula_name }}
FORMULA_URL: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.formula_url || inputs.formula_url }}
FORMULA_HOMEBREW_TAP: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.formula_homebrew_tap || inputs.formula_homebrew_tap }}
jobs:
bump-homebrew-formula:
name: Bump Homebrew formula
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout source repository
uses: actions/checkout@v4
- name: Update Homebrew formula
uses: mislav/bump-homebrew-formula-action@v3
with:
formula-name: ${{ env.FORMULA_NAME }}
formula-path: Formula/${{ env.FORMULA_NAME }}.rb
download-url: ${{ env.FORMULA_URL }}
homebrew-tap: ${{ env.FORMULA_HOMEBREW_TAP }}
tag-name: v${{ env.FORMULA_NEW_VERSION }}
base-branch: master
commit-message: Updated formula to version ${{ env.FORMULA_NEW_VERSION }}
update-version-badge:
name: Update version badge in README.md
runs-on: ubuntu-latest
needs: bump-homebrew-formula
permissions:
contents: write
steps:
- name: Checkout source repository
uses: actions/checkout@v4
- name: Update version in README.md
run: |
sed -i "s/v=${{ env.FORMULA_PREVIOUS_VERSION }}/v=${{ env.FORMULA_NEW_VERSION }}/" README.md
- name: Commit README.md update
run: |
git config user.name "GitHub Actions"
git config user.email "[email protected]"
git add README.md
git commit -m "Update version badge to ${{ env.FORMULA_NEW_VERSION }}"
git push origin master