-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
400 lines (393 loc) · 16.9 KB
/
Copy pathrelease.yml
File metadata and controls
400 lines (393 loc) · 16.9 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
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
name: release
on:
push:
tags: ["v[0-9]*"]
pull_request:
branches: ["main"]
workflow_dispatch:
inputs:
force:
description: "Force release even if one already exists"
type: boolean
default: false
concurrency:
group: release-${{ github.ref_name }}
env:
CARGO_TERM_COLOR: always
DRY_RUN: ${{ startsWith(github.ref, 'refs/tags/v') && '0' || '1' }}
RUST_BACKTRACE: 1
GITHUB_API_TOKEN: ${{ secrets.MISE_GH_TOKEN || secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.MISE_GH_TOKEN || secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.MISE_GH_TOKEN || secrets.GITHUB_TOKEN }}
jobs:
build-tarball-linux:
if: github.event_name != 'pull_request' || github.head_ref == 'release'
name: build-tarball-${{matrix.name}}
runs-on: namespace-profile-endev-linux-amd64-large
timeout-minutes: 45
env:
MINIO_AWS_ACCESS_KEY_ID: ${{ secrets.MINIO_AWS_ACCESS_KEY_ID }}
MINIO_AWS_SECRET_ACCESS_KEY: ${{ secrets.MINIO_AWS_SECRET_ACCESS_KEY }}
strategy:
fail-fast: false
matrix:
include:
- name: linux-x64
target: x86_64-unknown-linux-gnu
- name: linux-x64-musl
target: x86_64-unknown-linux-musl
- name: linux-arm64
target: aarch64-unknown-linux-gnu
- name: linux-arm64-musl
target: aarch64-unknown-linux-musl
- name: linux-armv7
target: armv7-unknown-linux-gnueabi
- name: linux-armv7-musl
target: armv7-unknown-linux-musleabi
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
- name: Install cross
uses: taiki-e/install-action@51cd0b8c0499559d9a4d75c0f5c67bec3a894ec8 # v2
with:
tool: cross
- name: build-tarball ${{matrix.target}}
uses: nick-fields/retry@ad984534de44a9489a53aefd81eb77f87c70dc60 # v4
with:
timeout_minutes: 45
max_attempts: 3
command: scripts/build-tarball.sh ${{matrix.target}}
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: tarball-${{matrix.target}}
path: |
dist/mise-*.tar.xz
dist/mise-*.tar.gz
dist/mise-*.tar.zst
if-no-files-found: error
build-tarball-macos:
if: github.event_name != 'pull_request' || github.head_ref == 'release'
name: build-tarball-${{matrix.name}}
runs-on: namespace-profile-endev-macos-arm64
timeout-minutes: 90
env:
MINIO_AWS_ACCESS_KEY_ID: ${{ secrets.MINIO_AWS_ACCESS_KEY_ID }}
MINIO_AWS_SECRET_ACCESS_KEY: ${{ secrets.MINIO_AWS_SECRET_ACCESS_KEY }}
strategy:
fail-fast: false
matrix:
include:
- name: macos-x64
target: x86_64-apple-darwin
- name: macos-arm64
target: aarch64-apple-darwin
steps:
- uses: apple-actions/import-codesign-certs@5142e029c445c10ffc7149d172e540235a065466 # v7
with:
p12-file-base64: ${{ secrets.APPLE_DEVELOPER_ID_APPLICATION_CERTS_P12 }}
p12-password: ${{ secrets.APPLE_DEVELOPER_ID_APPLICATION_CERTS_P12_PASS }}
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
- name: Setup Rust target
run: rustup target add ${{matrix.target}}
- name: build-tarball ${{matrix.target}}
uses: nick-fields/retry@ad984534de44a9489a53aefd81eb77f87c70dc60 # v4
with:
timeout_minutes: 90
max_attempts: 3
command: scripts/build-tarball.sh ${{matrix.target}}
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: tarball-${{matrix.target}}
path: |
dist/mise-*.tar.xz
dist/mise-*.tar.gz
dist/mise-*.tar.zst
if-no-files-found: error
build-tarball-windows:
if: github.event_name != 'pull_request' || github.head_ref == 'release'
name: build-tarball-windows-${{matrix.arch}}
runs-on: windows-latest
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
include:
- arch: arm64
target: aarch64-pc-windows-msvc
- arch: x64
target: x86_64-pc-windows-msvc
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
- run: rustup target add ${{matrix.target}}
- run: scripts/build-tarball.ps1 ${{matrix.target}}
env:
OS: windows
ARCH: ${{matrix.arch}}
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: tarball-${{matrix.target}}
path: dist/*.zip
if-no-files-found: error
e2e-linux:
if: github.event_name != 'pull_request' || github.head_ref == 'release'
name: e2e-linux-${{matrix.tranche}}
needs: [build-tarball-linux]
runs-on: ubuntu-latest
#container: ghcr.io/jdx/mise:github-actions
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
tranche: [0, 1, 2, 3, 4, 5, 6, 7]
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
- name: Install zsh/fish/direnv/fd
run: sudo apt-get update; sudo apt-get install zsh fish direnv fd-find liblzma-dev libbz2-dev
- name: Install fd-find
run: |
mkdir -p "$HOME/.local/bin"
ln -s "$(which fdfind)" "$HOME/.local/bin/fd"
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: tarball-x86_64-unknown-linux-gnu
path: dist
- uses: taiki-e/install-action@51cd0b8c0499559d9a4d75c0f5c67bec3a894ec8 # v2
with:
tool: usage-cli
- run: tar -C "$HOME" -xvf "dist/mise-$(./scripts/get-version.sh)-linux-x64.tar.zst"
- run: echo "$HOME/mise/bin" >> "$GITHUB_PATH"
- run: mise -v
- run: mise x wait-for-gh-rate-limit -- wait-for-gh-rate-limit
- run: mise i
- name: Run e2e tests
uses: nick-fields/retry@ad984534de44a9489a53aefd81eb77f87c70dc60 # v4
env:
TEST_TRANCHE: ${{matrix.tranche}}
TEST_TRANCHE_COUNT: 8
TEST_ALL: 1
with:
timeout_minutes: 20
max_attempts: 3
command: ./e2e/run_all_tests
rpm:
if: github.event_name != 'pull_request' || github.head_ref == 'release'
runs-on: ubuntu-latest
needs: [build-tarball-linux]
timeout-minutes: 10
container: ghcr.io/jdx/mise:rpm@sha256:4d4b300e61d9896e1846f1a55ada6937f65943f3341979dda5bc0cc019e49046
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
- uses: crazy-max/ghaction-import-gpg@2dc316deee8e90f13e1a351ab510b4d5bc0c82cd # v7
with:
gpg_private_key: ${{ secrets.MISE_GPG_KEY }}
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: tarball-x86_64-unknown-linux-gnu
path: dist
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: tarball-aarch64-unknown-linux-gnu
path: dist
- run: scripts/build-rpm.sh
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: rpm
path: dist/rpmrepo
if-no-files-found: error
deb:
if: github.event_name != 'pull_request' || github.head_ref == 'release'
runs-on: ubuntu-latest
needs: [build-tarball-linux]
container: ghcr.io/jdx/mise:deb@sha256:7f8a538db9e31f782f5e91b458f31ac9f96b55ddd6659789e07f3072cba44dac
timeout-minutes: 10
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
- uses: crazy-max/ghaction-import-gpg@2dc316deee8e90f13e1a351ab510b4d5bc0c82cd # v7
with:
gpg_private_key: ${{ secrets.MISE_GPG_KEY }}
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: tarball-x86_64-unknown-linux-gnu
path: dist
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: tarball-aarch64-unknown-linux-gnu
path: dist
- run: scripts/build-deb.sh
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: deb
path: dist/deb
if-no-files-found: error
release:
runs-on: ubuntu-24.04
timeout-minutes: 30
permissions:
contents: write
needs:
- rpm
- deb
- e2e-linux
- build-tarball-linux
- build-tarball-macos
- build-tarball-windows
if: ${{ !cancelled() && !failure() }}
steps:
- name: Verify all build targets succeeded
if: github.event_name != 'pull_request' || github.head_ref == 'release'
run: |
failed=""
for result in \
"${{ needs.build-tarball-linux.result }}" \
"${{ needs.build-tarball-macos.result }}" \
"${{ needs.build-tarball-windows.result }}" \
"${{ needs.e2e-linux.result }}" \
"${{ needs.rpm.result }}" \
"${{ needs.deb.result }}"; do
if [ "$result" != "success" ]; then
failed="true"
fi
done
if [ -n "$failed" ]; then
echo "::error::One or more required jobs did not succeed:"
echo " build-tarball-linux: ${{ needs.build-tarball-linux.result }}"
echo " build-tarball-macos: ${{ needs.build-tarball-macos.result }}"
echo " build-tarball-windows: ${{ needs.build-tarball-windows.result }}"
echo " e2e-linux: ${{ needs.e2e-linux.result }}"
echo " rpm: ${{ needs.rpm.result }}"
echo " deb: ${{ needs.deb.result }}"
exit 1
fi
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
with:
fetch-depth: 0
- name: Check for existing release
id: check-release
if: startsWith(github.ref, 'refs/tags/v') && inputs.force != true
run: |
VERSION="$(./scripts/get-version.sh)"
if gh api "repos/${{ github.repository }}/releases/tags/$VERSION" --jq '.draft' 2>/dev/null; then
DRAFT="$(gh api "repos/${{ github.repository }}/releases/tags/$VERSION" --jq '.draft')"
if [[ "$DRAFT" == "false" ]]; then
echo "::warning::Release $VERSION already exists and is published — skipping publish steps"
echo "exists=true" >> "$GITHUB_OUTPUT"
else
echo "Draft release $VERSION exists — will continue publishing"
echo "exists=false" >> "$GITHUB_OUTPUT"
fi
else
echo "No release found for $VERSION"
echo "exists=false" >> "$GITHUB_OUTPUT"
fi
- name: Skip release for non-release branch PRs
if: github.event_name == 'pull_request' && github.head_ref != 'release'
run: |
echo "Skipping release steps for PR from non-release branch"
echo "All release operations will be skipped"
- uses: crazy-max/ghaction-import-gpg@2dc316deee8e90f13e1a351ab510b4d5bc0c82cd # v7
if: github.event_name != 'pull_request' || github.head_ref == 'release'
with:
gpg_private_key: ${{ secrets.MISE_GPG_KEY }}
git_user_signingkey: true
git_commit_gpgsign: true
- run: ./scripts/setup-zipsign.sh
if: github.event_name != 'pull_request' || github.head_ref == 'release'
env:
ZIPSIGN: ${{ secrets.ZIPSIGN }}
- name: Install fd-find
if: github.event_name != 'pull_request' || github.head_ref == 'release'
run: |
sudo apt-get update
sudo apt-get install fd-find minisign
mkdir -p "$HOME/.local/bin"
ln -s "$(which fdfind)" "$HOME/.local/bin/fd"
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
if: github.event_name != 'pull_request' || github.head_ref == 'release'
with: { path: artifacts }
- run: ls -R artifacts
if: github.event_name != 'pull_request' || github.head_ref == 'release'
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
if: github.event_name != 'pull_request' || github.head_ref == 'release'
with:
path: artifacts
pattern: |
mise-v*.tar.gz
mise-v*.tar.xz
mise-v*.tar.zst
mise-v*.zip
merge-multiple: true
- run: echo "${{ secrets.MINISIGN_KEY }}" >minisign.key
if: github.event_name != 'pull_request' || github.head_ref == 'release'
- run: ls -R artifacts
if: github.event_name != 'pull_request' || github.head_ref == 'release'
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
if: github.event_name != 'pull_request' || github.head_ref == 'release'
with:
name: tarball-x86_64-unknown-linux-gnu
path: dist
- run: tar -C "$HOME" -xvf "dist/mise-$(./scripts/get-version.sh)-linux-x64.tar.zst"
if: github.event_name != 'pull_request' || github.head_ref == 'release'
- run: echo "$HOME/mise/bin" >> "$GITHUB_PATH"
if: github.event_name != 'pull_request' || github.head_ref == 'release'
- run: which mise && mise -v && mise i
if: github.event_name != 'pull_request' || github.head_ref == 'release'
- run: mise x -- scripts/release.sh
if: github.event_name != 'pull_request' || github.head_ref == 'release'
- name: Generate release notes
if: startsWith(github.ref, 'refs/tags/v') && steps.check-release.outputs.exists != 'true'
run: |
VERSION="$(./scripts/get-version.sh)"
if mise x -- communique generate "$VERSION" -o /tmp/release-notes.txt; then
TITLE="$(head -1 /tmp/release-notes.txt | sed 's/^#* //' | sed "s/^$VERSION: //")"
echo "RELEASE_TITLE=$VERSION: $TITLE" >> "$GITHUB_ENV"
# Remove the title line (and any blank line after it) from the notes body
tail -n +2 /tmp/release-notes.txt | sed '/./,$!d' > /tmp/release-notes-body.txt
mv /tmp/release-notes-body.txt /tmp/release-notes.txt
else
echo "::warning::communique failed, falling back to git-cliff changelog"
mise x -- git cliff --strip all --latest > /tmp/release-notes.txt 2>/dev/null || echo "Release $VERSION" > /tmp/release-notes.txt
echo "RELEASE_TITLE=$VERSION" >> "$GITHUB_ENV"
fi
# Strip any pre-existing sponsor section from the generated notes
# (communique has at times included its own) and trim trailing blanks,
# so the heredoc below always produces exactly one canonical block.
awk '
/^## (💚 )?Sponsor mise[[:space:]]*$/ { exit }
/^[[:space:]]*$/ { blanks++; next }
{ while (blanks-- > 0) print ""; blanks = 0; print }
' /tmp/release-notes.txt > /tmp/release-notes-trimmed.txt
mv /tmp/release-notes-trimmed.txt /tmp/release-notes.txt
cat >> /tmp/release-notes.txt <<'EOF'
## 💚 Sponsor mise
mise is maintained by [@jdx](https://github.com/jdx), an open source developer for [**entire.io**](https://entire.io), the title sponsor of the [jdx.dev](https://jdx.dev) open source tools. Development is funded by sponsors.
If mise saves you or your team time, please consider sponsoring at [jdx.dev](https://jdx.dev/sponsors.html). Individual and company sponsorships keep mise fast, free, and independent.
EOF
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
- name: Create Draft GitHub Release
if: startsWith(github.ref, 'refs/tags/v') && steps.check-release.outputs.exists != 'true'
run: |
VERSION="$(./scripts/get-version.sh)"
gh release create "$VERSION" \
--title "$RELEASE_TITLE" \
--notes-file /tmp/release-notes.txt \
--verify-tag \
--draft \
"releases/$VERSION"/*
env:
GH_TOKEN: ${{ secrets.MISE_GH_TOKEN }}
- name: Publish Release Assets to CDN
if: startsWith(github.ref, 'refs/tags/v') && steps.check-release.outputs.exists != 'true'
run: mise x -- scripts/publish-release.sh
env:
CLOUDFLARE_ACCESS_KEY_ID: ${{ secrets.CLOUDFLARE_ACCESS_KEY_ID }}
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }}
CLOUDFLARE_SECRET_ACCESS_KEY: ${{ secrets.CLOUDFLARE_SECRET_ACCESS_KEY }}
- name: Publish GitHub Release
if: startsWith(github.ref, 'refs/tags/v') && steps.check-release.outputs.exists != 'true'
run: |
VERSION="$(./scripts/get-version.sh)"
gh release edit "$VERSION" --draft=false
env:
GH_TOKEN: ${{ secrets.MISE_GH_TOKEN }}