-
Notifications
You must be signed in to change notification settings - Fork 0
112 lines (91 loc) · 3.73 KB
/
release_packages.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
name: Release packages
on:
release:
types:
- released
permissions:
contents: read
jobs:
update-homebrew:
name: Update Homebrew Tap
runs-on: ubuntu-latest
steps:
- name: Checkout Salami repo
uses: actions/checkout@v3
with:
ref: ${{ github.event.release.target_commitish }}
path: salami
- name: Checkout Salami homebrew repo
uses: actions/checkout@v3
with:
repository: petrgazarov/homebrew-salami
path: homebrew_salami
token: ${{ secrets.HOMEBREW_SALAMI_GITHUB_TOKEN }}
- name: Get Salami version
id: get-salami-version
run: echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Generate Homebrew Tap
env:
GH_TOKEN: ${{ github.token }}
run: |
export SALAMI_VERSION="${{ steps.get-salami-version.outputs.version }}"
gh release download --repo petrgazarov/salami "${SALAMI_VERSION}" -p 'salami*darwin*' -p 'salami*linux*' --skip-existing
for i in \
"darwin x64 SALAMI_DARWIN_X64" \
"darwin arm64 SALAMI_DARWIN_ARM64" \
"linux x64 SALAMI_LINUX_X64" \
"linux arm64 SALAMI_LINUX_ARM64" \
; do
set -- $i
OS="$1"
ARCH="$2"
ENV_VAR="$3"
SHA256="$(sha256sum "salami-${SALAMI_VERSION}-${OS}-${ARCH}" | cut -f1 -d' ')"
SHA256_VAR="${ENV_VAR}_SHA256"
URL_VAR="${ENV_VAR}_URL"
export "${SHA256_VAR}=${SHA256}"
export "${URL_VAR}=https://github.com/petrgazarov/salami/releases/download/${SALAMI_VERSION}/salami-${SALAMI_VERSION}-${OS}-${ARCH}"
done
envsubst '$SALAMI_VERSION,$SALAMI_DARWIN_X64_URL,$SALAMI_DARWIN_X64_SHA256,$SALAMI_DARWIN_ARM64_URL,$SALAMI_DARWIN_ARM64_SHA256,$SALAMI_LINUX_X64_URL,$SALAMI_LINUX_X64_SHA256,$SALAMI_LINUX_ARM64_URL,$SALAMI_LINUX_ARM64_SHA256' < "./salami/.github/templates/salami_tap_template.rb" > ./homebrew_salami/salami.rb
- name: Commit updated formula
working-directory: homebrew_salami
run: |
set -euo pipefail
git config user.name petrgazarov
git config user.email [email protected]
git add salami.rb
echo "::group::git diff"
git --no-pager diff
echo "::endgroup::"
git commit -m "Brew formula update for Salami version ${{ steps.get-salami-version.outputs.version }}"
- name: Push formula
working-directory: homebrew_salami
run: |
set -euo pipefail
git push origin HEAD:main
update-chocolatey:
name: Update Chocolatey Package
runs-on: ubuntu-latest
steps:
- name: Checkout Salami repo
uses: actions/checkout@v3
with:
ref: ${{ github.event.release.target_commitish }}
path: salami
- name: Checkout Salami chocolatey repo
uses: actions/checkout@v3
with:
repository: petrgazarov/salami-chocolatey
path: salami_chocolatey
token: ${{ secrets.CHOCOLATEY_SALAMI_GITHUB_TOKEN }}
- name: Get Salami version
id: get-salami-version
run: echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Push tag to Salami chocolatey repo
working-directory: salami_chocolatey
run: |
set -euo pipefail
git config user.name petrgazarov
git config user.email [email protected]
git tag -a "${{ steps.get-salami-version.outputs.version }}" -m "Chocolatey package update for Salami version ${{ steps.get-salami-version.outputs.version }}"
git push origin "${{ steps.get-salami-version.outputs.version }}"