forked from metabase/metabase
-
Notifications
You must be signed in to change notification settings - Fork 0
796 lines (719 loc) · 28.4 KB
/
release.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
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
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
name: Release 3 - Publish Release
run-name: Publish Release ${{ inputs.version }}
on:
workflow_dispatch:
inputs:
version:
description: 'Metabase version (e.g. v0.46.3)'
type: string
required: true
commit:
description: 'A full-length commit SHA-1 hash'
required: true
skip-docker:
description: 'Skip Docker image publishing'
type: boolean
default: false
skip-s3:
description: 'Skip S3 artifact publishing'
type: boolean
default: false
skip-version-info:
description: 'Skip publishing version-info.json'
type: boolean
default: false
skip-tag:
description: 'Skip tagging the release'
type: boolean
default: false
skip-release-notes:
description: 'Skip publishing release notes'
type: boolean
default: false
auto:
description: 'auto-patch release DO NOT SET MANUALLY'
type: boolean
default: false
jobs:
check-version:
runs-on: ubuntu-22.04
timeout-minutes: 10
outputs:
ee: ${{ fromJson(steps.canonical_version.outputs.result).ee }}
oss: ${{ fromJson(steps.canonical_version.outputs.result).oss }}
steps:
- name: Fail early on the incorrect version format
if: ${{ !(startsWith(inputs.version,'v0.') || startsWith(inputs.version,'v1.')) }}
run: |
echo "The version format is invalid!"
echo "It must start with either 'v0.' or 'v1.'."
echo "Please, try again."
exit 1
- uses: actions/checkout@v4
with:
sparse-checkout: release
- name: Prepare build scripts
run: cd ${{ github.workspace }}/release && yarn && yarn build
- name: Get Release Version
uses: actions/github-script@v7
id: canonical_version
with:
script: | # js
const { isValidVersionString, getCanonicalVersion, hasBeenReleased } = require('${{ github.workspace }}/release/dist/index.cjs');
const version = '${{ inputs.version }}';
if (!isValidVersionString(version)) {
throw new Error("The version format is invalid! It must start with either 'v0.' or 'v1.'.");
}
const versions = {
ee: getCanonicalVersion(version, 'ee'),
oss: getCanonicalVersion(version, 'oss'),
};
const ossReleased = await hasBeenReleased({
github,
owner: context.repo.owner,
repo: context.repo.repo,
version: versions.oss,
});
const eeReleased = await hasBeenReleased({
github,
owner: context.repo.owner,
repo: context.repo.repo,
version: versions.ee,
});
if (ossReleased || eeReleased) {
throw new Error("This version has already been released!", version);
}
return versions;
publish-start-message:
runs-on: ubuntu-22.04
needs: [check-version]
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: release
- name: Prepare build scripts
run: cd ${{ github.workspace }}/release && yarn && yarn build
- name: Send publish start message
uses: actions/github-script@v7
env:
SLACK_RELEASE_CHANNEL: ${{ vars.SLACK_RELEASE_CHANNEL }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
with:
script: | # js
const { sendPublishStartMessage } = require('${{ github.workspace }}/release/dist/index.cjs');
await sendPublishStartMessage({
owner: context.repo.owner,
repo: context.repo.repo,
version: '${{ inputs.version }}',
runId: '${{ github.run_id }}',
channelName: '${{ vars.SLACK_RELEASE_CHANNEL }}',
}).catch(console.error);
download-uberjar:
needs: check-version
runs-on: ubuntu-22.04
timeout-minutes: 10
strategy:
matrix:
edition: [oss, ee]
steps:
- name: find_release_artifact
id: find_release_artifact
uses: actions/github-script@v7
with:
result-encoding: string
script: | # js
const fs = require('fs');
const artifacts = await github.rest.actions.listArtifactsForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
name: `metabase-release-${{ matrix.edition }}-${{ inputs.commit }}-uberjar`,
per_page: 1,
});
if (!artifacts.data?.artifacts?.[0]?.id) {
throw new Error(`No artifacts found for ${{ inputs.commit }}`);
}
const artifact_id = artifacts.data.artifacts[0].id;
const download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: artifact_id,
archive_format: 'zip',
});
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/mb.zip`, Buffer.from(download.data));
- name: unzip uberjar artifact
run: unzip mb.zip
- name: Verify that this is a valid JAR file
run: file --mime-type ./metabase.jar | grep "application/zip"
- name: Reveal its version.properties
run: jar xf metabase.jar version.properties && cat version.properties
- name: Check JAR version properties
run: |
# ensure actual jar checksum matches checksum file
grep -q $(sha256sum ./metabase.jar) SHA256.sum && echo "checksums match" || (echo "checksum mismatch" && exit 1)
# ensure stored commit-id file matches input commit
grep -q ${{ inputs.commit }} COMMIT-ID && echo "commit ids match" || (echo "commit-id mismatch" && exit 1)
# ensure version.properties partial commit matches commit input
grep -q $(cut -c 1-7 <<< ${{ inputs.commit }}) version.properties && echo "version.properties commit matches" || (echo "version.properties commit mismatch" && exit 1)
# ensure version.properties version number matches input version (without v0/v1 to make it ee/oss agnostic)
grep -q $(cut -c 3-99 <<< ${{ inputs.version }}) version.properties && echo "version.properties version number matches" || (echo "version.properties version number mismatch" && exit 1)
# ensure the build is not a snapshot build
grep -q "SNAPSHOT" version.properties && (echo "jar is a snapshot" && exit 1) || echo "jar is not a snapshot build"
- name: Upload Uberjar as artifact
uses: actions/upload-artifact@v4
with:
name: metabase-${{ matrix.edition }}-uberjar
path: |
./metabase.jar
./COMMIT-ID
./SHA256.sum
./version.properties
upload-to-s3:
if: ${{ inputs.skip-s3 != true }}
runs-on: ubuntu-22.04
needs: download-uberjar
timeout-minutes: 15
strategy:
matrix:
edition: [oss, ee]
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_S3_RELEASE_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_S3_RELEASE_SECRET_ACCESS_KEY }}
aws-region: ${{ vars.AWS_REGION }}
- uses: actions/checkout@v4
with:
sparse-checkout: release
- name: prepare release scripts
run: cd release && yarn && yarn build
- uses: actions/download-artifact@v4
name: Retrieve uberjar artifact
with:
name: metabase-${{ matrix.edition }}-uberjar
- name: Determine the upload path ## EE is always v1.x.y, OSS is always v0.x.y
uses: actions/github-script@v7
id: version_path
with:
result-encoding: string
script: |
const version = '${{ inputs.version }}';
const edition = '${{ matrix.edition }}';
const version_path = edition === 'ee'
? 'enterprise/' + version.replace(/^v0\./, "v1.") // always e.g. v1.47.2
: version.replace(/^v1\./, "v0."); // always e.g. v0.45.6;
console.log("The download path for this", edition, "edition is", version_path);
return version_path;
- name: Upload to S3
run: aws s3 cp ./metabase.jar s3://${{ vars.AWS_S3_DOWNLOADS_BUCKET }}/${{ steps.version_path.outputs.result }}/metabase.jar
- name: Create cloudfront invalidation
run: |
aws cloudfront create-invalidation \
--distribution-id ${{ vars.AWS_CLOUDFRONT_DOWNLOADS_ID }} \
--paths /${{ steps.version_path.outputs.result }}/metabase.jar
verify-s3-download:
if: ${{ inputs.skip-s3 != true }}
runs-on: ubuntu-22.04
needs: upload-to-s3
timeout-minutes: 15
strategy:
matrix:
edition: [oss, ee]
steps:
- uses: actions/download-artifact@v4
name: Retrieve uberjar artifact
with:
name: metabase-${{ matrix.edition }}-uberjar
- name: Determine the download path ## EE is always v1.x.y, OSS is always v0.x.y
uses: actions/github-script@v7
id: version_path
with:
result-encoding: string
script: | # js
const version = '${{ inputs.version }}';
const edition = '${{ matrix.edition }}';
const version_path = edition === 'ee'
? 'enterprise/' + version.replace(/^v0\./, "v1.") // always e.g. v1.47.2
: version.replace(/^v1\./, "v0."); // always e.g. v0.45.6;
console.log("The download path for this", edition, "edition is", version_path);
return version_path;
- name: Upload to S3
run:
curl -L http://${{ vars.AWS_S3_DOWNLOADS_BUCKET }}.s3.${{ vars.AWS_REGION }}.amazonaws.com/${{ steps.version_path.outputs.result }}/metabase.jar -o metabase-downloaded.jar
- name: Verify Checksum
run: grep -q $(sha256sum ./metabase-downloaded.jar) SHA256.sum && echo "checksums match" || exit 1
containerize:
if: ${{ inputs.skip-docker != true }}
runs-on: ubuntu-22.04
needs: [check-version, download-uberjar]
timeout-minutes: 15
strategy:
matrix:
edition: [oss, ee]
services:
registry:
image: registry:2
ports:
- 5000:5000
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # IMPORTANT! to get all the tags
- name: prepare release scripts
run: cd release && yarn && yarn build
- name: Determine the docker version tag
uses: actions/github-script@v7
id: canonical_version
with:
result-encoding: string
script: |
const version = '${{ inputs.version }}';
const edition = '${{ matrix.edition }}';
const canonical_version = edition === 'ee'
? '${{ needs.check-version.outputs.ee }}'
: '${{ needs.check-version.outputs.oss }}';
console.log("The canonical version of this Metabase", edition, "edition is", canonical_version);
return canonical_version;
- uses: actions/download-artifact@v4
name: Retrieve previously downloaded Uberjar
with:
name: metabase-${{ matrix.edition }}-uberjar
- name: Move the Uberjar to the context dir
run: mv ./metabase.jar bin/docker/.
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
with:
driver-opts: network=host
- name: Build ${{ matrix.edition }} container
uses: docker/build-push-action@v3
with:
context: bin/docker/.
platforms: linux/amd64
network: host
tags: localhost:5000/local-metabase:${{ steps.canonical_version.outputs.result }}
no-cache: true
push: true
- name: Launch container
run: docker run --rm -dp 3000:3000 localhost:5000/local-metabase:${{ steps.canonical_version.outputs.result }}
timeout-minutes: 5
- name: Wait for Metabase to start
run: while ! curl -s 'http://localhost:3000/api/health' | grep '{"status":"ok"}'; do sleep 1; done
timeout-minutes: 3
- name: Determine the target Docker Hub repository
run: |
if [[ "${{ matrix.edition }}" == "ee" ]]; then
echo "Metabase EE: image is going to be pushed to ${{ github.repository_owner }}/metabase-enterprise"
echo "DOCKERHUB_REPO=${{ github.repository_owner }}/metabase-enterprise" >> $GITHUB_ENV
else
echo "Metabase OSS: image is going to be pushed to ${{ github.repository_owner }}/metabase"
echo "DOCKERHUB_REPO=${{ github.repository_owner }}/metabase" >> $GITHUB_ENV
fi
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_RELEASE_USERNAME }}
password: ${{ secrets.DOCKERHUB_RELEASE_TOKEN }}
- name: Retag and push container image to Docker Hub
run: |
echo "Pushing ${{ steps.canonical_version.outputs.result }} to ${{ env.DOCKERHUB_REPO }} ..."
docker tag localhost:5000/local-metabase:${{ steps.canonical_version.outputs.result }} ${{ env.DOCKERHUB_REPO }}:${{ steps.canonical_version.outputs.result }}
docker push ${{ env.DOCKERHUB_REPO }}:${{ steps.canonical_version.outputs.result }}
echo "Finished!"
verify-docker-pull:
if: ${{ inputs.skip-docker != true }}
runs-on: ubuntu-22.04
needs: containerize
timeout-minutes: 15
strategy:
matrix:
edition: [oss, ee]
steps:
- name: Login to Docker Hub # authenticated, to avoid being rate-throttled
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_RELEASE_USERNAME }}
password: ${{ secrets.DOCKERHUB_RELEASE_TOKEN }}
- name: Determine the container image to pull
run: |
if [[ "${{ matrix.edition }}" = "ee" ]]; then
echo "DOCKERHUB_REPO=${{ github.repository_owner }}/metabase-enterprise" >> $GITHUB_ENV
else
echo "DOCKERHUB_REPO=${{ github.repository_owner }}/metabase" >> $GITHUB_ENV
fi
- name: Determine the docker version tag
uses: actions/github-script@v7
id: canonical_version
with:
result-encoding: string
script: |
const version = '${{ inputs.version }}';
const edition = '${{ matrix.edition }}';
const canonical_version = edition === "ee"
? version.replace(/^v0\./, "v1.") // always e.g. v1.47.2
: version.replace(/^v1\./, "v0."); // always e.g. v0.47.2
console.log("The canonical version of this Metabase", edition, "edition is", canonical_version);
return canonical_version;
- name: Pull the container image
run: |
echo "Pulling container image ${{ env.DOCKERHUB_REPO }}:${{ steps.canonical_version.outputs.result }} ..."
docker pull ${{ env.DOCKERHUB_REPO }}:${{ steps.canonical_version.outputs.result }}
echo "Successful!"
- name: Launch container
run: docker run --rm -dp 3000:3000 ${{ env.DOCKERHUB_REPO }}:${{ steps.canonical_version.outputs.result }}
timeout-minutes: 5
- name: Wait for Metabase to start
run: while ! curl -s 'http://localhost:3000/api/health' | grep '{"status":"ok"}'; do sleep 1; done
timeout-minutes: 3
push-tags:
if: ${{ inputs.skip-tag != true }}
permissions: write-all
needs: [verify-s3-download, verify-docker-pull, check-version]
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: release
- name: prepare release scripts
run: cd release && yarn && yarn build
- name: Tag Release
uses: actions/github-script@v7
with:
result-encoding: string
script: | # js
const { tagRelease } = require('${{ github.workspace }}/release/dist/index.cjs');
const OSSversion = '${{ needs.check-version.outputs.oss }}';
const EEversion = '${{ needs.check-version.outputs.ee }}';
// push EE tag
await tagRelease({
github,
owner: context.repo.owner,
repo: context.repo.repo,
version: EEversion,
commitHash: '${{ inputs.commit }}',
}).catch((err) => {
console.error('Failed to tag release', EEversion, err);
process.exit(1);
});
// push OSS tag
await tagRelease({
github,
owner: context.repo.owner,
repo: context.repo.repo,
version: OSSversion,
commitHash: '${{ inputs.commit }}',
}).catch((err) => {
console.error('Failed to tag release', OSSversion, err);
process.exit(1);
});
- name: Reorder release tags to put OSS first
run: |
git config user.name github-actions
git config user.email github-actions@github.com
$GITHUB_WORKSPACE/release/reorder-tags.sh ${{ needs.check-version.outputs.ee }} ${{ inputs.commit }}
trigger-docs-update:
if: ${{ !inputs.auto && inputs.skip-release-notes != true }}
needs:
- push-tags
- check-version
runs-on: ubuntu-22.04
timeout-minutes: 10
permissions:
contents: write
pull-requests: write
env:
NEW_OSS_VERSION: ${{ needs.check-version.outputs.oss }}
NEW_EE_VERSION: ${{ needs.check-version.outputs.ee }}
GH_TOKEN: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
steps:
- uses: actions/github-script@v7
with:
github-token: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
script: | # js
await github.rest.repos.createDispatchEvent({
owner: '${{ github.repository_owner }}',
repo: '${{ secrets.DOCS_REPO }}',
event_type: 'trigger-docs-update',
client_payload: {
version: '${{ inputs.version }}'
}
});
- uses: actions/checkout@v4
with:
token: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
- name: update releases.md
uses: actions/github-script@v7
with:
github-token: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
script: | # js
const fs = require('fs');
const releaseText = fs.readFileSync('./docs/releases.md', 'utf8');
const newReleaseText = releaseText
.replace(
/## Metabase Enterprise Edition releases\n\n/,
`## Metabase Enterprise Edition releases\n\n- [${process.env.NEW_EE_VERSION}](https://github.com/metabase/metabase/releases/tag/${process.env.NEW_EE_VERSION})\n`
)
.replace(
/## Metabase Open Source Edition releases\n\n/,
`## Metabase Open Source Edition releases\n\n- [${process.env.NEW_OSS_VERSION}](https://github.com/metabase/metabase/releases/tag/${process.env.NEW_OSS_VERSION})\n`
);
fs.writeFileSync('./docs/releases.md', newReleaseText);
- name: commit and push updates
run: | # bash
git config --global user.email "metabase-bot@metabase.com"
git config --global user.name "Metabase bot"
git checkout -b docs-add-$NEW_OSS_VERSION
cd docs/
git add releases.md
git commit -m "Add $NEW_OSS_VERSION to the list of releases"
git push origin docs-add-$NEW_OSS_VERSION --force
- name: open pr with updates
run: | # bash
gh pr create --fill \
--body "Like it says on the tin 😁" \
--label "Type:Documentation" \
--label "backport" \
--reviewer "jeff-bruemmer" \
--assignee "jeff-bruemmer"
trigger-cloud-issues:
if: ${{ !inputs.auto }}
needs: push-tags
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- uses: actions/github-script@v7
with:
github-token: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
script: | # js
const version = '${{ inputs.version }}';
const enterpriseVersion = version.replace(/^v0\./, "v1.");
github.rest.repos.createDispatchEvent({
owner: '${{ github.repository_owner }}',
repo: '${{ vars.OPS_REPO }}',
event_type: 'create-release-issues',
client_payload: {
version: enterpriseVersion,
}
});
trigger-ee-extra-pr:
needs: verify-s3-download
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- uses: actions/github-script@v7
with:
github-token: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
script: | # js
const version = '${{ inputs.version }}';
const enterpriseVersion = version.replace(/^v0\./, "v1.");
github.rest.repos.createDispatchEvent({
owner: '${{ github.repository_owner }}',
repo: 'metabase-ee-extra',
event_type: 'update-ee-extra-build',
client_payload: {
version: enterpriseVersion,
auto: 'true', // always auto-merge
}
});
draft-release-notes:
if: ${{ !inputs.auto && inputs.skip-release-notes != true }}
needs: push-tags
runs-on: ubuntu-22.04
timeout-minutes: 15
permissions: write-all
env:
AWS_S3_DOWNLOADS_BUCKET: ${{ vars.AWS_S3_DOWNLOADS_BUCKET }}
DOCKERHUB_OWNER: ${{ vars.DOCKERHUB_OWNER }}
DOCKERHUB_REPO: ${{ vars.DOCKERHUB_REPO }}
strategy:
matrix:
edition: [oss, ee]
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: release
- name: prepare release scripts
run: cd release && yarn && yarn build
- uses: actions/download-artifact@v4
name: Retrieve uberjar artifact
with:
name: metabase-${{ matrix.edition }}-uberjar
- name: Read Checksum
run: |
CHECKSUM=$(cat SHA256.sum)
echo "CHECKSUM=$CHECKSUM" >> $GITHUB_ENV
- name: Publish draft release notes
uses: actions/github-script@v7
with:
result-encoding: string
script: |
const { publishRelease, getCanonicalVersion } = require('${{ github.workspace }}/release/dist/index.cjs');
const version = '${{ inputs.version }}';
const edition = '${{ matrix.edition }}';
const canonical_version = getCanonicalVersion(version, edition);
await publishRelease({
github,
owner: context.repo.owner,
repo: context.repo.repo,
version: canonical_version,
checksum: '${{ env.CHECKSUM }}',
}).then(() => {
console.log('Successfully published release notes', '${{ inputs.version }}');
}).catch((err) => {
console.error('Failed to publish release notes', '${{ inputs.version }}', err);
process.exit(1);
});
publish-version-info:
if: ${{ !inputs.auto && inputs.skip-version-info != true }}
runs-on: ubuntu-22.04
needs: [push-tags, check-version]
timeout-minutes: 15
strategy:
matrix:
edition: [oss, ee]
env:
AWS_S3_STATIC_BUCKET: ${{ vars.AWS_S3_STATIC_BUCKET }}
AWS_REGION: ${{ vars.AWS_REGION }}
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_S3_RELEASE_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_S3_RELEASE_SECRET_ACCESS_KEY }}
aws-region: ${{ vars.AWS_REGION }}
- uses: actions/checkout@v4
with:
sparse-checkout: release
- name: Prepare build scripts
run: cd ${{ github.workspace }}/release && yarn && yarn build
- name: Publish release notes
uses: actions/github-script@v7
id: new_version_info
with:
result-encoding: string
script: | # js
const { getVersionInfo } = require('${{ github.workspace }}/release/dist/index.cjs');
const fs = require('fs');
const edition = '${{ matrix.edition }}';
const canonical_version = edition === 'ee'
? '${{ needs.check-version.outputs.ee }}'
: '${{ needs.check-version.outputs.oss }}';
const newVersionInfo = await getVersionInfo({
github,
owner: context.repo.owner,
repo: context.repo.repo,
version: canonical_version,
});
fs.writeFileSync('version-info.json', JSON.stringify(newVersionInfo));
- name: Upload new version-info.json to S3
run: |
if [[ "${{ matrix.edition }}" == "ee" ]]; then
aws s3 cp version-info.json s3://${{ vars.AWS_S3_STATIC_BUCKET }}/version-info-ee.json
else
aws s3 cp version-info.json s3://${{ vars.AWS_S3_STATIC_BUCKET }}/version-info.json
fi
- name: Create cloudfront invalidation for version-info.json and version-info-ee.json
run: |
aws cloudfront create-invalidation \
--distribution-id ${{ vars.AWS_CLOUDFRONT_STATIC_ID }} \
--paths "/version-info.json" "/version-info-ee.json"
tag-nightly:
if: ${{ inputs.auto }}
needs: [push-tags, verify-docker-pull, verify-s3-download]
uses: ./.github/workflows/release-tag.yml
with:
version: ${{ inputs.version }}
tag_name: nightly
tag_rollout: 100
tag_ee: true
tag_oss: true
publish-complete-message:
if: ${{ !inputs.auto }}
runs-on: ubuntu-22.04
needs: [draft-release-notes, verify-docker-pull, verify-s3-download, publish-version-info]
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: release
- name: Prepare build scripts
run: cd ${{ github.workspace }}/release && yarn && yarn build
- name: Send publish complete message
uses: actions/github-script@v7
env:
SLACK_RELEASE_CHANNEL: ${{ vars.SLACK_RELEASE_CHANNEL }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
with:
script: | # js
const { sendPublishCompleteMessage } = require('${{ github.workspace }}/release/dist/index.cjs');
await sendPublishCompleteMessage({
owner: context.repo.owner,
repo: context.repo.repo,
version: '${{ inputs.version }}',
runId: '${{ github.run_id }}',
channelName: '${{ vars.SLACK_RELEASE_CHANNEL }}',
generalChannelName: 'general',
}).catch(console.error);
auto-publish-complete-message:
if: ${{ inputs.auto }}
runs-on: ubuntu-22.04
needs: tag-nightly
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: release
- name: Prepare build scripts
run: cd ${{ github.workspace }}/release && yarn && yarn build
- name: Send auto publish complete message
uses: actions/github-script@v7
env:
SLACK_RELEASE_CHANNEL: ${{ vars.SLACK_RELEASE_CHANNEL }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
with:
script: | # js
const { sendPublishCompleteMessage } = require('${{ github.workspace }}/release/dist/index.cjs');
await sendPublishCompleteMessage({
owner: context.repo.owner,
repo: context.repo.repo,
version: '${{ inputs.version }}',
runId: '${{ github.run_id }}',
channelName: '${{ vars.SLACK_RELEASE_CHANNEL }}',
generalChannelName: '',
}).catch(console.error);
manage-milestones:
if: ${{ !inputs.auto }}
permissions: write-all
runs-on: ubuntu-22.04
needs: [draft-release-notes, publish-version-info] # this will ensure that the milestone stays open until the release notes are published
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: release
- name: Prepare build scripts
run: cd ${{ github.workspace }}/release && yarn && yarn build
- name: Update milestones
uses: actions/github-script@v7
with:
script: | # js
const { closeMilestone, openNextMilestones, isRCVersion } = require('${{ github.workspace }}/release/dist/index.cjs');
const version = '${{ inputs.version }}';
if (isRCVersion(version)) {
console.log("This is a release candidate, skipping milestone management");
return;
}
await closeMilestone({
github,
owner: context.repo.owner,
repo: context.repo.repo,
version,
});
await openNextMilestones({
github,
owner: context.repo.owner,
repo: context.repo.repo,
version,
});