-
Notifications
You must be signed in to change notification settings - Fork 1
307 lines (255 loc) · 11 KB
/
release.yml
File metadata and controls
307 lines (255 loc) · 11 KB
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
name: Release
on:
release:
types: [created]
workflow_dispatch:
permissions:
contents: write
concurrency:
group: release
cancel-in-progress: false
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
matrix:
node-version: ['24', '22', '20']
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup Node
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run unit tests
run: npm test
build:
needs: test
strategy:
matrix:
include:
- os: ubuntu-latest
target: linux-x64
platform: linux
arch: amd64
- os: ubuntu-latest
target: linux-arm64
platform: linux
arch: arm64
- os: macos-latest
target: darwin-x64
platform: darwin
arch: amd64
- os: macos-latest
target: darwin-arm64
platform: darwin
arch: arm64
- os: windows-latest
target: windows-x64
platform: windows
arch: amd64
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
with:
bun-version: 1
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Build TypeScript
run: bun run build
- name: Build binary
shell: bash
run: |
BINARY_NAME="make-cli-${{ matrix.platform }}-${{ matrix.arch }}"
if [ "${{ matrix.platform }}" = "windows" ]; then
bun build dist/index.js --compile --target=bun-${{ matrix.target }} --outfile="${BINARY_NAME}.exe"
else
bun build dist/index.js --compile --target=bun-${{ matrix.target }} --outfile="${BINARY_NAME}"
fi
- name: Import Apple Developer ID cert
if: matrix.platform == 'darwin'
uses: apple-actions/import-codesign-certs@b610f78488812c1e56b20e6df63ec42d833f2d14 # v6.0.0
with:
p12-file-base64: ${{ secrets.APPLE_DEVELOPER_ID_CERT_P12 }}
p12-password: ${{ secrets.APPLE_DEVELOPER_ID_CERT_PASSWORD }}
- name: Install Apple Developer ID intermediate CAs
if: matrix.platform == 'darwin'
shell: bash
run: |
set -euo pipefail
curl -fsSL -o DeveloperIDG2CA.cer https://www.apple.com/certificateauthority/DeveloperIDG2CA.cer
curl -fsSL -o DeveloperIDCA.cer https://www.apple.com/certificateauthority/DeveloperIDCA.cer
for cert_file in DeveloperIDG2CA.cer DeveloperIDCA.cer; do
if ! output=$(security import "${cert_file}" -k signing_temp.keychain 2>&1); then
if echo "${output}" | grep -q "already exists"; then
echo "${cert_file} already present in signing_temp.keychain"
else
echo "${output}"
exit 1
fi
fi
done
rm DeveloperIDG2CA.cer DeveloperIDCA.cer
- name: Sign macOS binary
if: matrix.platform == 'darwin'
shell: bash
env:
BINARY_NAME: make-cli-${{ matrix.platform }}-${{ matrix.arch }}
run: |
set -euo pipefail
codesign --remove-signature "${BINARY_NAME}" || true
IDENTITY="$(security find-identity -v -p codesigning \
| awk -F'"' '/Developer ID Application/ { print $2; exit }')"
if [ -z "${IDENTITY}" ]; then
echo "::error::No valid 'Developer ID Application' identity found"
exit 1
fi
echo "Signing identity: ${IDENTITY}"
codesign \
--force \
--options runtime \
--entitlements build/entitlements.mac.plist \
--timestamp \
--sign "${IDENTITY}" \
"${BINARY_NAME}"
codesign --verify --strict --verbose "${BINARY_NAME}"
codesign -dv --verbose=4 "${BINARY_NAME}"
- name: Notarize macOS binary
if: matrix.platform == 'darwin'
shell: bash
env:
BINARY_NAME: make-cli-${{ matrix.platform }}-${{ matrix.arch }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
APPLE_APP_PASSWORD: ${{ secrets.APPLE_APP_PASSWORD }}
run: |
set -euo pipefail
ZIP_PATH="${BINARY_NAME}.notarize.zip"
ditto -c -k --keepParent "${BINARY_NAME}" "${ZIP_PATH}"
xcrun notarytool submit "${ZIP_PATH}" \
--apple-id "${APPLE_ID}" \
--team-id "${APPLE_TEAM_ID}" \
--password "${APPLE_APP_PASSWORD}" \
--wait
rm -f "${ZIP_PATH}"
- name: Create tar.gz archive
shell: bash
run: |
BINARY_NAME="make-cli-${{ matrix.platform }}-${{ matrix.arch }}"
if [ "${{ matrix.platform }}" = "windows" ]; then
tar -czvf "${BINARY_NAME}.tar.gz" "${BINARY_NAME}.exe"
else
tar -czvf "${BINARY_NAME}.tar.gz" "${BINARY_NAME}"
fi
- name: Upload artifact
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: make-cli-${{ matrix.platform }}-${{ matrix.arch }}.tar.gz
path: make-cli-*.tar.gz
retention-days: 7
build-deb:
needs: build
if: github.event_name == 'release'
runs-on: ubuntu-latest
strategy:
matrix:
arch: [amd64, arm64]
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Download linux binary
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: make-cli-linux-${{ matrix.arch }}.tar.gz
path: .
- name: Extract binary
run: |
mkdir -p bin
tar -xzvf "make-cli-linux-${{ matrix.arch }}.tar.gz" -C bin/
- name: Build Debian package
run: |
VERSION="${GITHUB_REF_NAME#v}"
./scripts/build-deb.sh "$VERSION" "${{ matrix.arch }}"
- name: Upload artifact
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: make-cli-linux-${{ matrix.arch }}.deb
path: deb/*.deb
retention-days: 7
release:
needs: [build, build-deb]
if: github.event_name == 'release'
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
with:
bun-version: latest
- name: Setup Node
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: 24
registry-url: 'https://registry.npmjs.org'
cache: 'npm'
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Build
run: bun run build
- name: Publish to npm
run: npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Download all artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
path: artifacts/
- name: Create release
uses: softprops/action-gh-release@153bb8e04406b158c6c84fc1615b65b24149a1fe # v2.6.1
with:
files: |
artifacts/**/*
update-homebrew:
needs: release
if: github.event_name == 'release'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
with:
bun-version: latest
- name: Download artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
path: artifacts/
- name: Generate Homebrew formula
run: |
VERSION="${GITHUB_REF_NAME#v}"
VERSION="$VERSION" ARTIFACTS_DIR="artifacts" bun run scripts/update-homebrew.ts
- name: Push to homebrew-tap
env:
SSH_PRIVATE_KEY: ${{ secrets.HOMEBREW_TAP_DEPLOY_KEY }}
run: |
mkdir -p ~/.ssh
echo "$SSH_PRIVATE_KEY" > ~/.ssh/deploy_key
chmod 600 ~/.ssh/deploy_key
ssh-keyscan github.com >> ~/.ssh/known_hosts
git clone git@github.com:integromat/homebrew-tap.git tap --config core.sshCommand="ssh -i ~/.ssh/deploy_key"
cp make-cli.rb tap/make-cli.rb
cd tap
git config user.name "make-cli-release-bot"
git config user.email "make-cli-release-bot@make.com"
git config core.sshCommand "ssh -i ~/.ssh/deploy_key"
git add make-cli.rb
git diff --staged --quiet || git commit -m "make-cli ${GITHUB_REF_NAME#v}"
git push