-
Notifications
You must be signed in to change notification settings - Fork 6
65 lines (58 loc) · 2.04 KB
/
homebrew.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
name: Update Homebrew
on:
workflow_run:
workflows: ["Release naisdevice"]
types:
- completed
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
update-cask:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Get Latest version
id: latest_version
uses: abatilo/release-info-action@5774bec4e3eabad433b4ae8f625e83afa0e7bb22
with:
owner: nais
repo: device
- uses: navikt/github-app-token-generator@v1
id: get-brew-token
with:
private-key: ${{ secrets.NAIS_APP_PRIVATE_KEY }}
app-id: ${{ secrets.NAIS_APP_ID }}
repo: nais/homebrew-tap
- name: Checkout homebrew-tap
uses: actions/checkout@v4
with:
repository: nais/homebrew-tap
token: ${{ steps.get-brew-token.outputs.token }}
path: taprepo
- name: Update version and checksum in cask
id: update_cask
env:
LATEST: ${{ steps.latest_version.outputs.latest_tag }}
LATEST_DATE: ${{ steps.latest_version.outputs.latest_tag_published_at }}
run: |
echo "Version ${LATEST} was released at ${LATEST_DATE}"
if [[ "${LATEST}" == "null" ]]; then
echo "Invalid version!"
exit 1
fi
cd taprepo
git config user.email "[email protected]"
git config user.name "naisdevice pipeline"
for pkg in naisdevice naisdevice-tenant ; do
url=https://github.com/nais/device/releases/download/${LATEST}/${pkg}.pkg
checksum=$(curl --location ${url}.sha256)
sed -E -i "s#version \".*?\"#version \"${LATEST}\"#" Casks/${pkg}.rb
sed -E -i "s#sha256 \".*?\"#sha256 \"${checksum}\"#" Casks/${pkg}.rb
done
git add Casks/naisdevice*.rb
if ! git --no-pager diff --cached --exit-code; then
git commit -a -m "Bump naisdevice.pkg version to ${LATEST}"
git push
fi