-
Notifications
You must be signed in to change notification settings - Fork 1
90 lines (73 loc) · 2.86 KB
/
update_formula.yaml
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
80
81
82
83
84
85
86
87
88
89
90
name: Update formula
on:
workflow_dispatch:
inputs:
package:
description: 'Package / formula name'
required: true
type: string
version:
description: 'Package version'
required: true
type: string
workflow_call:
inputs:
package:
description: 'Package / formula name'
required: true
type: string
version:
description: 'Package version'
required: true
type: string
jobs:
test-updated-formula:
name: Test updated formula
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Homebrew
uses: Homebrew/actions/setup-homebrew@master
- name: Update package in formula
run: ./.github/scripts/update_formula.sh ${{ github.event.inputs.package }} ${{ github.event.inputs.version }}
- name: Test updated formula
run: |
set -o errexit
export HOMEBREW_NO_AUTO_UPDATE=1
export HOMEBREW_NO_ANALYTICS=1
export HOMEBREW_NO_INSTALL_CLEANUP=1
# Disable formula migrations for this test,
# otherwise `brew install` would install the formula from homebrew-core instead of the local repository clone
rm ./tap_migrations.json
# Install the updated formula
# (due to setup-homebrew magic, the working directory is also considered as a tap, so no need to copy around the updated formula file)
brew install $GITHUB_REPOSITORY/${{ github.event.inputs.package }}
# Run the formula tests
brew test ${{ github.event.inputs.package }}
update-formula:
name: Update formula and commit result
needs: [test-updated-formula]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Update package version and commit result
env:
GH_TOKEN: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
run: |
set -o errexit
./.github/scripts/update_formula.sh ${{ github.event.inputs.package }} ${{ github.event.inputs.version }}
git config user.name 'Apify Service Account'
git config user.email '64261774+apify-service-account@users.noreply.github.com'
git checkout -b feat/update-${{ github.event.inputs.package }}-to-${{ github.event.inputs.version }}
git add Formula/${{ github.event.inputs.package }}.rb
git commit -m "Updating \`${{ github.event.inputs.package }}\` to version \`${{ github.event.inputs.version }}\`"
git push --set-upstream origin feat/update-${{ github.event.inputs.package }}-to-${{ github.event.inputs.version }}
gh pr create --fill --base ${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
gh pr merge --auto --squash --delete-branch