This repository was archived by the owner on Mar 5, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
424 lines (385 loc) · 16.1 KB
/
release.yml
File metadata and controls
424 lines (385 loc) · 16.1 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
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
name: Release
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'
env:
CARGO_TERM_COLOR: always
TOTAL_TARGETS: 8
jobs:
notify-start:
name: Notify Release Start
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
slack_ts: ${{ steps.slack.outputs.ts }}
steps:
- name: Send Slack notification
id: slack
uses: slackapi/slack-github-action@485a9d42d3a73031f12ec201c457e2162c45d02d # v2.0.0
with:
method: chat.postMessage
token: ${{ secrets.SLACK_BOT_TOKEN }}
payload: |
channel: ${{ secrets.SLACK_CHANNEL_ID }}
text: "Release ${{ github.ref_name }} started"
blocks:
- type: "section"
text:
type: "mrkdwn"
text: "*Release ${{ github.ref_name }}*\n\n:hourglass_flowing_sand: Building frontend...\n:white_square: Creating release...\n:white_square: Building binaries (0/${{ env.TOTAL_TARGETS }})\n:white_square: Validating release..."
- type: "context"
elements:
- type: "mrkdwn"
text: "Triggered by ${{ github.actor }} | <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Workflow>"
- name: Save Slack timestamp to artifact
env:
SLACK_TS: ${{ steps.slack.outputs.ts }}
REF_NAME: ${{ github.ref_name }}
run: |
mkdir -p slack-data
echo "$SLACK_TS" > slack-data/message_ts.txt
echo "$REF_NAME" > slack-data/version.txt
- name: Upload Slack data
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: slack-notification-data
path: slack-data/
retention-days: 3
detect-prerelease:
name: Detect Pre-release
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
is_prerelease: ${{ steps.check.outputs.is_prerelease }}
steps:
- name: Check for pre-release tag
id: check
env:
TAG: ${{ github.ref_name }}
run: |
if [[ "$TAG" =~ -(alpha|beta|rc) ]]; then
echo "is_prerelease=true" >> "$GITHUB_OUTPUT"
else
echo "is_prerelease=false" >> "$GITHUB_OUTPUT"
fi
build-frontend:
name: Build Frontend
needs: [notify-start]
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 22
- name: Setup pnpm
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4
with:
version: 10
- name: Cache pnpm store
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: ~/.local/share/pnpm/store
key: pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: pnpm-store-
- name: Install dependencies
run: pnpm install --filter console-frontend --frozen-lockfile
- name: Build frontend for binary embedding
run: pnpm run build:binary
- name: Upload frontend artifacts
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: frontend-dist
path: packages/console-frontend/dist-binary/
retention-days: 1
- name: Update Slack - Frontend Built
if: success()
continue-on-error: true
uses: slackapi/slack-github-action@485a9d42d3a73031f12ec201c457e2162c45d02d # v2.0.0
with:
method: chat.update
token: ${{ secrets.SLACK_BOT_TOKEN }}
payload: |
channel: ${{ secrets.SLACK_CHANNEL_ID }}
ts: ${{ needs.notify-start.outputs.slack_ts }}
text: "Release ${{ github.ref_name }} in progress"
blocks:
- type: "section"
text:
type: "mrkdwn"
text: "*Release ${{ github.ref_name }}*\n\n:white_check_mark: Frontend built\n:hourglass_flowing_sand: Creating release...\n:white_square: Building binaries (0/${{ env.TOTAL_TARGETS }})\n:white_square: Validating release..."
- type: "context"
elements:
- type: "mrkdwn"
text: "Triggered by ${{ github.actor }} | <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Workflow>"
- name: Update Slack - Frontend Failed
if: failure()
continue-on-error: true
uses: slackapi/slack-github-action@485a9d42d3a73031f12ec201c457e2162c45d02d # v2.0.0
with:
method: chat.update
token: ${{ secrets.SLACK_BOT_TOKEN }}
payload: |
channel: ${{ secrets.SLACK_CHANNEL_ID }}
ts: ${{ needs.notify-start.outputs.slack_ts }}
text: "Release ${{ github.ref_name }} failed"
blocks:
- type: "section"
text:
type: "mrkdwn"
text: "*Release ${{ github.ref_name }}* :x:\n\n:x: Frontend build failed\n:white_square: Creating release...\n:white_square: Building binaries (0/${{ env.TOTAL_TARGETS }})\n:white_square: Validating release..."
- type: "context"
elements:
- type: "mrkdwn"
text: "Triggered by ${{ github.actor }} | <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Logs>"
create-release:
name: Create Release
needs: [notify-start, detect-prerelease, build-frontend]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Generate token
id: generate_token
uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2
with:
app-id: ${{ secrets.III_CI_APP_ID }}
private-key: ${{ secrets.III_CI_APP_PRIVATE_KEY }}
- name: Checkout code
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
persist-credentials: false
- name: Create Release
uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2
with:
token: ${{ steps.generate_token.outputs.token }}
draft: false
prerelease: ${{ needs.detect-prerelease.outputs.is_prerelease == 'true' }}
generate_release_notes: true
- name: Update Slack - Release Created
continue-on-error: true
uses: slackapi/slack-github-action@485a9d42d3a73031f12ec201c457e2162c45d02d # v2.0.0
with:
method: chat.update
token: ${{ secrets.SLACK_BOT_TOKEN }}
payload: |
channel: ${{ secrets.SLACK_CHANNEL_ID }}
ts: ${{ needs.notify-start.outputs.slack_ts }}
text: "Release ${{ github.ref_name }} in progress"
blocks:
- type: "section"
text:
type: "mrkdwn"
text: "*Release ${{ github.ref_name }}*\n\n:white_check_mark: Frontend built\n:white_check_mark: Release created\n:hourglass_flowing_sand: Building binaries (0/${{ env.TOTAL_TARGETS }})\n:white_square: Validating release..."
- type: "context"
elements:
- type: "mrkdwn"
text: "Triggered by ${{ github.actor }} | <${{ github.server_url }}/${{ github.repository }}/releases/tag/${{ github.ref_name }}|View Release>"
build-release:
name: Build Release Binaries
needs: [create-release, build-frontend]
runs-on: ${{ matrix.os }}
permissions:
contents: write
env:
SKIP_FRONTEND_BUILD: "1"
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-apple-darwin
os: macos-15-intel
- target: aarch64-apple-darwin
os: macos-latest
- target: x86_64-pc-windows-msvc
os: windows-latest
- target: i686-pc-windows-msvc
os: windows-latest
- target: aarch64-pc-windows-msvc
os: windows-latest
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
persist-credentials: false
- name: Download frontend artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: frontend-dist
path: packages/console-rust/assets/
- name: Install cross-compilation tools
if: runner.os == 'Linux'
env:
BUILD_TARGET: ${{ matrix.target }}
run: |
sudo apt-get update
case "$BUILD_TARGET" in
x86_64-unknown-linux-musl)
sudo apt-get install -y musl-tools
;;
aarch64-unknown-linux-gnu)
sudo apt-get install -y gcc-aarch64-linux-gnu libc6-dev-arm64-cross
;;
esac
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@4be9e76fd7c4901c61fb841f559994984270fce7 # stable
with:
targets: ${{ matrix.target }}
- name: Cache cargo registry & build
uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2
with:
key: ${{ matrix.target }}-${{ hashFiles('packages/console-rust/Cargo.lock') }}
workspaces: packages/console-rust
- name: Verify Windows cross-compilation tools
if: runner.os == 'Windows' && matrix.target != 'x86_64-pc-windows-msvc'
shell: pwsh
env:
BUILD_TARGET: ${{ matrix.target }}
run: |
rustup target add $env:BUILD_TARGET
rustup target list --installed | Select-String $env:BUILD_TARGET
- name: Build and upload binary
uses: taiki-e/upload-rust-binary-action@f391289bcff6a7f36b6301c0a74199657bbb4561 # v1
with:
bin: iii-console
target: ${{ matrix.target }}
tar: unix
zip: windows
checksum: sha256
manifest-path: packages/console-rust/Cargo.toml
token: ${{ secrets.GITHUB_TOKEN }}
notify-builds-complete:
name: Update Build Status
needs: [notify-start, build-release]
runs-on: ubuntu-latest
permissions: {}
if: always()
steps:
- name: Check build results
id: check_builds
env:
BUILD_RESULT: ${{ needs.build-release.result }}
run: |
if [ "$BUILD_RESULT" == "success" ]; then
echo "emoji=:white_check_mark:" >> "$GITHUB_OUTPUT"
echo "count=$TOTAL_TARGETS/$TOTAL_TARGETS" >> "$GITHUB_OUTPUT"
else
echo "emoji=:warning:" >> "$GITHUB_OUTPUT"
echo "count=partial" >> "$GITHUB_OUTPUT"
fi
- name: Update Slack - Builds Complete
uses: slackapi/slack-github-action@485a9d42d3a73031f12ec201c457e2162c45d02d # v2.0.0
with:
method: chat.update
token: ${{ secrets.SLACK_BOT_TOKEN }}
payload: |
channel: ${{ secrets.SLACK_CHANNEL_ID }}
ts: ${{ needs.notify-start.outputs.slack_ts }}
text: "Release ${{ github.ref_name }} builds complete"
blocks:
- type: "section"
text:
type: "mrkdwn"
text: "*Release ${{ github.ref_name }}*\n\n:white_check_mark: Frontend built\n:white_check_mark: Release created\n${{ steps.check_builds.outputs.emoji }} Binaries built (${{ steps.check_builds.outputs.count }})\n:hourglass_flowing_sand: Validating release..."
- type: "context"
elements:
- type: "mrkdwn"
text: "Triggered by ${{ github.actor }} | <${{ github.server_url }}/${{ github.repository }}/releases/tag/${{ github.ref_name }}|View Release>"
trigger-homebrew:
name: Trigger Homebrew Publish
needs: [build-release, detect-prerelease]
runs-on: ubuntu-latest
if: needs.detect-prerelease.outputs.is_prerelease != 'true'
permissions:
actions: write
steps:
- name: Trigger Homebrew workflow
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7
env:
RELEASE_VERSION: ${{ github.ref_name }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
await github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'publish-homebrew.yml',
ref: 'main',
inputs: {
version: process.env.RELEASE_VERSION,
dry_run: 'false'
}
});
notify-complete:
name: Notify Release Complete
needs: [notify-start, detect-prerelease, create-release, build-frontend, build-release, notify-builds-complete]
if: always()
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Determine overall status
id: status
env:
CREATE_RESULT: ${{ needs.create-release.result }}
BUILD_RESULT: ${{ needs.build-release.result }}
FRONTEND_RESULT: ${{ needs.build-frontend.result }}
run: |
if [[ "$CREATE_RESULT" == "success" && \
"$BUILD_RESULT" == "success" && \
"$FRONTEND_RESULT" == "success" ]]; then
{
echo "result=success"
echo "emoji=:white_check_mark:"
echo "text=completed successfully"
} >> "$GITHUB_OUTPUT"
else
{
echo "result=failure"
echo "emoji=:x:"
echo "text=failed"
} >> "$GITHUB_OUTPUT"
fi
- name: Update Slack notification
if: needs.notify-start.outputs.slack_ts != ''
uses: slackapi/slack-github-action@485a9d42d3a73031f12ec201c457e2162c45d02d # v2.0.0
with:
method: chat.update
token: ${{ secrets.SLACK_BOT_TOKEN }}
payload: |
channel: ${{ secrets.SLACK_CHANNEL_ID }}
ts: ${{ needs.notify-start.outputs.slack_ts }}
text: "Release ${{ github.ref_name }} ${{ steps.status.outputs.text }}"
blocks:
- type: "section"
text:
type: "mrkdwn"
text: "*Release ${{ github.ref_name }}* ${{ steps.status.outputs.emoji }}\n\n${{ needs.build-frontend.result == 'success' && ':white_check_mark:' || ':x:' }} Frontend build: ${{ needs.build-frontend.result }}\n${{ needs.create-release.result == 'success' && ':white_check_mark:' || ':x:' }} Create release: ${{ needs.create-release.result }}\n${{ needs.build-release.result == 'success' && ':white_check_mark:' || ':x:' }} Build binaries: ${{ needs.build-release.result }}\nPre-release: ${{ needs.detect-prerelease.outputs.is_prerelease }}"
- type: "context"
elements:
- type: "mrkdwn"
text: "<${{ github.server_url }}/${{ github.repository }}/releases/tag/${{ github.ref_name }}|View Release> | <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Workflow>"
- name: Send new notification on failure
if: needs.notify-start.outputs.slack_ts == '' && steps.status.outputs.result == 'failure'
uses: slackapi/slack-github-action@485a9d42d3a73031f12ec201c457e2162c45d02d # v2.0.0
with:
method: chat.postMessage
token: ${{ secrets.SLACK_BOT_TOKEN }}
payload: |
channel: ${{ secrets.SLACK_CHANNEL_ID }}
text: ":x: *iii-console Release Failed*\nVersion: `${{ github.ref_name }}`\n<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View workflow>"