-
Notifications
You must be signed in to change notification settings - Fork 192
689 lines (681 loc) · 41.9 KB
/
publish-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
name: Publish release
on:
workflow_dispatch:
inputs:
isPreRelease:
description: 'Tag created is a pre-release tag'
required: true
default: 'false'
preReleaseSuffix:
description: 'The text that will be suffixed to the Git tag. e.g., rc1'
required: false
default: ''
permissions:
id-token: write
contents: write
jobs:
publish-release:
name: Publish Release
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17.0.7'
- name: Set version env variable
id: version-set
run: |
SHORT_VERSION=$((grep -w 'version' | cut -d= -f2 | cut -d- -f1) < gradle.properties)
DIST_VERSION=$((grep -w 'version' | cut -d= -f2) < gradle.properties | rev | cut --complement -d- -f1 | rev)
LANG_VERSION=$((grep -w "ballerinaLangVersion" | cut -d= -f2 | cut -d- -f1 | xargs) < gradle.properties)
CODE_NAME=$((grep -w 'codeName' | cut -d= -f2) < gradle.properties)
RELEASE_VERSION=$DIST_VERSION
TAGGED_VERSION=$RELEASE_VERSION
LONG_VERSION=$DIST_VERSION-$CODE_NAME
if [ -n "${{ github.event.inputs.preReleaseSuffix }}" ]; then
TAGGED_VERSION=$RELEASE_VERSION-${{ github.event.inputs.preReleaseSuffix }}
fi
echo VERSION=$RELEASE_VERSION >> $GITHUB_ENV
echo GIT_TAG=$TAGGED_VERSION >> $GITHUB_ENV
echo "::set-output name=version::$RELEASE_VERSION"
echo "::set-output name=sversion::$SHORT_VERSION"
echo "::set-output name=taggedVersion::$TAGGED_VERSION"
echo "::set-output name=longVersion::$LONG_VERSION"
echo "::set-output name=langVersion::$LANG_VERSION"
- name: Pre release depenency version update
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
run: |
echo "Version: ${VERSION}"
echo "Tagged Version: ${GIT_TAG}"
git config user.name ${{ secrets.BALLERINA_BOT_USERNAME }}
git config user.email ${{ secrets.BALLERINA_BOT_EMAIL }}
git checkout -b release-${GIT_TAG}
- name: Generate UUID
run: |
UUID=$(uuidgen)
perl -pi -e "s/^\s*installerVersion=.*/installerVersion=$UUID/" gradle.properties
git config user.name ${{ secrets.BALLERINA_BOT_USERNAME }}
git config user.email ${{ secrets.BALLERINA_BOT_EMAIL }}
git add gradle.properties
git commit -m "Update UUID for installer"
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Publish artifact
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
packageUser: ${{ secrets.BALLERINA_BOT_USERNAME }}
packagePAT: ${{ secrets.BALLERINA_BOT_TOKEN }}
devCentralToken: ${{ secrets.BALLERINA_CENTRAL_DEV_ACCESS_TOKEN }}
prodCentralToken: ${{ secrets.BALLERINA_CENTRAL_ACCESS_TOKEN }}
githubAccessToken: ${{ secrets.GITHUB_TOKEN }}
ballerinaBotWorkflow: $ {{ secrets.BALLERINA_BOT_WORKFLOW }}
run: |
./gradlew build -Pversion=${VERSION}
./gradlew release -Prelease.useAutomaticVersion=true -x test
- name: Checkout docker repo
uses: actions/checkout@v3
with:
repository: ballerina-platform/module-ballerina-docker
path: module-ballerina-docker
- name: Copy zip artifact
run: cp ballerina/build/distributions/ballerina-22*.zip module-ballerina-docker/base/docker/
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Build the docker image
id: docker_build
uses: docker/build-push-action@v2
with:
context: module-ballerina-docker/base/docker/
load: true
push: false
tags: ballerina/ballerina:release-test
build-args: |
BALLERINA_DIST=ballerina-${{ steps.version-set.outputs.sversion }}.zip
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: 'ballerina/ballerina:release-test'
skip-dirs: 'ballerina/runtime/examples'
format: 'table'
exit-code: '1'
timeout: "10m0s"
- name: cosign-installer
uses: sigstore/cosign-installer@v3.5.0
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '14'
- name: Install GitHub CLI
run: |
npm install -g github-cli
gh --version
- name: Get Markdown file
id: file-url
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh repo view ballerina-platform/ballerina-dev-website --json url --jq '.clone_url'
gh api repos/ballerina-platform/ballerina-dev-website/contents/downloads/verify-ballerina-artifacts.md -H 'Accept: application/vnd.github.v3.raw' > release_notes.md
sed -i '1,10d' release_notes.md
- name: Retrieve Branch
id: retrieve-branch
run: |
branchName=$(echo ${{ github.ref }} | cut -d'/' -f3)
echo "::set-output name=branchName::$branchName"
- name: Update Markdown file
run: |
if ${{ github.event.inputs.isPreRelease }} == 'true'; then
echo "" > release_notes.md;
else sed -i 's/{{ version }}/${{ steps.version-set.outputs.taggedVersion }}/g' release_notes.md; sed -i 's/{{ branch }}/${{ steps.retrieve-branch.outputs.branchName }}/g' release_notes.md; fi
- name: Read release notes from file
id: release_notes
uses: actions/github-script@v4
with:
github-token: ${{ secrets.BALLERINA_BOT_TOKEN }}
script: |
const fs = require('fs');
const releaseNotes = fs.readFileSync('release_notes.md', 'utf8');
core.setOutput('notes', releaseNotes);
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
with:
tag_name: "v${{ steps.version-set.outputs.taggedVersion }}"
release_name: ${{ steps.version-set.outputs.taggedVersion }}
body: ${{ steps.release_notes.outputs.notes }}
draft: false
prerelease: ${{ github.event.inputs.isPreRelease }}
- name: Create linux-deb Installer
id: run_installers_deb
run: |
cd installers/linux-deb
./build-ballerina-linux-deb-x64.sh -v ${{ steps.version-set.outputs.longVersion }} -p ./../../ballerina/build/distributions
echo "Created linux-deb successfully"
- name: Sign the linux-deb installer
run: |
cosign sign-blob installers/linux-deb/target/ballerina-${{ steps.version-set.outputs.longVersion }}-linux-x64.deb --output-certificate ballerina-${{ steps.version-set.outputs.longVersion }}-linux-x64.deb.pem --output-signature ballerina-${{ steps.version-set.outputs.longVersion }}-linux-x64.deb.sig --yes
- name: Verify the linux-deb installer
run: |
cosign verify-blob installers/linux-deb/target/ballerina-${{ steps.version-set.outputs.longVersion }}-linux-x64.deb --certificate ballerina-${{ steps.version-set.outputs.longVersion }}-linux-x64.deb.pem --signature ballerina-${{ steps.version-set.outputs.longVersion }}-linux-x64.deb.sig --certificate-identity=https://github.com/ballerina-platform/ballerina-distribution/.github/workflows/publish-release.yml@${{ github.ref }} --certificate-oidc-issuer=https://token.actions.githubusercontent.com
- name: Create linux-rpm Installer
id: run_installers_rpm
run: |
cd installers/linux-rpm
./build-ballerina-linux-rpm-x64.sh -v ${{ steps.version-set.outputs.longVersion }} -p ./../../ballerina/build/distributions
echo "Created linux-rpm successfully"
- name: Sign the linux-rpm installer
run: |
cosign sign-blob installers/linux-rpm/rpmbuild/RPMS/x86_64/ballerina-${{ steps.version-set.outputs.longVersion }}-linux-x64.rpm --output-certificate ballerina-${{ steps.version-set.outputs.longVersion }}-linux-x64.rpm.pem --output-signature ballerina-${{ steps.version-set.outputs.longVersion }}-linux-x64.rpm.sig --yes
- name: Verify the linux-rpm installer
run: |
cosign verify-blob installers/linux-rpm/rpmbuild/RPMS/x86_64/ballerina-${{ steps.version-set.outputs.longVersion }}-linux-x64.rpm --certificate ballerina-${{ steps.version-set.outputs.longVersion }}-linux-x64.rpm.pem --signature ballerina-${{ steps.version-set.outputs.longVersion }}-linux-x64.rpm.sig --certificate-identity=https://github.com/ballerina-platform/ballerina-distribution/.github/workflows/publish-release.yml@${{ github.ref }} --certificate-oidc-issuer=https://token.actions.githubusercontent.com
- name: Generate Hashes
run: |
openssl dgst -sha256 -out ballerina-${{ steps.version-set.outputs.longVersion }}-linux-x64.deb.sha256 installers/linux-deb/target/ballerina-*-linux-x64.deb
openssl dgst -sha256 -out ballerina-${{ steps.version-set.outputs.longVersion }}-linux-x64.rpm.sha256 installers/linux-rpm/rpmbuild/RPMS/x86_64/ballerina-*-linux-x64.rpm
openssl dgst -sha256 -out ballerina-${{ steps.version-set.outputs.longVersion }}.zip.sha256 ballerina/build/distributions/ballerina-${{ steps.version-set.outputs.longVersion }}.zip
openssl dgst -sha256 -out ballerina-${{ steps.version-set.outputs.sversion }}.zip.sha256 ballerina/build/distributions/ballerina-${{ steps.version-set.outputs.sversion }}.zip
- name: Sign the zip artifacts
run: |
cosign sign-blob ballerina/build/distributions/ballerina-${{ steps.version-set.outputs.longVersion }}.zip --output-certificate ballerina-${{ steps.version-set.outputs.longVersion }}.pem --output-signature ballerina-${{ steps.version-set.outputs.longVersion }}.sig --yes
cosign sign-blob ballerina/build/distributions/ballerina-${{ steps.version-set.outputs.sversion }}.zip --output-certificate ballerina-${{ steps.version-set.outputs.sversion }}.pem --output-signature ballerina-${{ steps.version-set.outputs.sversion }}.sig --yes
cosign sign-blob ballerina/build/distributions/ballerina-${{ steps.version-set.outputs.longVersion }}-macos.zip --output-certificate ballerina-${{ steps.version-set.outputs.longVersion }}-macos.pem --output-signature ballerina-${{ steps.version-set.outputs.longVersion }}-macos.sig --yes
cosign sign-blob ballerina/build/distributions/ballerina-${{ steps.version-set.outputs.longVersion }}-macos-arm.zip --output-certificate ballerina-${{ steps.version-set.outputs.longVersion }}-macos-arm.pem --output-signature ballerina-${{ steps.version-set.outputs.longVersion }}-macos-arm.sig --yes
cosign sign-blob ballerina/build/distributions/ballerina-${{ steps.version-set.outputs.longVersion }}-windows.zip --output-certificate ballerina-${{ steps.version-set.outputs.longVersion }}-windows.pem --output-signature ballerina-${{ steps.version-set.outputs.longVersion }}-windows.sig --yes
- name: Verify the zip artifacts
run: |
cosign verify-blob ballerina/build/distributions/ballerina-${{ steps.version-set.outputs.longVersion }}.zip --certificate ballerina-${{ steps.version-set.outputs.longVersion }}.pem --signature ballerina-${{ steps.version-set.outputs.longVersion }}.sig --certificate-identity=https://github.com/ballerina-platform/ballerina-distribution/.github/workflows/publish-release.yml@${{ github.ref }} --certificate-oidc-issuer=https://token.actions.githubusercontent.com
cosign verify-blob ballerina/build/distributions/ballerina-${{ steps.version-set.outputs.sversion }}.zip --certificate ballerina-${{ steps.version-set.outputs.sversion }}.pem --signature ballerina-${{ steps.version-set.outputs.sversion }}.sig --certificate-identity=https://github.com/ballerina-platform/ballerina-distribution/.github/workflows/publish-release.yml@${{ github.ref }} --certificate-oidc-issuer=https://token.actions.githubusercontent.com
cosign verify-blob ballerina/build/distributions/ballerina-${{ steps.version-set.outputs.longVersion }}-macos.zip --certificate ballerina-${{ steps.version-set.outputs.longVersion }}-macos.pem --signature ballerina-${{ steps.version-set.outputs.longVersion }}-macos.sig --certificate-identity=https://github.com/ballerina-platform/ballerina-distribution/.github/workflows/publish-release.yml@${{ github.ref }} --certificate-oidc-issuer=https://token.actions.githubusercontent.com
cosign verify-blob ballerina/build/distributions/ballerina-${{ steps.version-set.outputs.longVersion }}-macos-arm.zip --certificate ballerina-${{ steps.version-set.outputs.longVersion }}-macos-arm.pem --signature ballerina-${{ steps.version-set.outputs.longVersion }}-macos-arm.sig --certificate-identity=https://github.com/ballerina-platform/ballerina-distribution/.github/workflows/publish-release.yml@${{ github.ref }} --certificate-oidc-issuer=https://token.actions.githubusercontent.com
cosign verify-blob ballerina/build/distributions/ballerina-${{ steps.version-set.outputs.longVersion }}-windows.zip --certificate ballerina-${{ steps.version-set.outputs.longVersion }}-windows.pem --signature ballerina-${{ steps.version-set.outputs.longVersion }}-windows.sig --certificate-identity=https://github.com/ballerina-platform/ballerina-distribution/.github/workflows/publish-release.yml@${{ github.ref }} --certificate-oidc-issuer=https://token.actions.githubusercontent.com
- name: Upload zip artifacts
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: ballerina-${{ steps.version-set.outputs.longVersion }}.zip
asset_path: ballerina/build/distributions/ballerina-${{ steps.version-set.outputs.longVersion }}.zip
asset_content_type: application/octet-stream
- name: Upload zip artifact's Certificate
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: ballerina-${{ steps.version-set.outputs.longVersion }}.pem
asset_path: ./ballerina-${{ steps.version-set.outputs.longVersion }}.pem
asset_content_type: application/octet-stream
- name: Upload zip artifact's Signature
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: ballerina-${{ steps.version-set.outputs.longVersion }}.sig
asset_path: ./ballerina-${{ steps.version-set.outputs.longVersion }}.sig
asset_content_type: application/octet-stream
- name: Upload zip without tool artifacts
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: ballerina-${{ steps.version-set.outputs.sversion }}.zip
asset_path: ballerina/build/distributions/ballerina-${{ steps.version-set.outputs.sversion }}.zip
asset_content_type: application/octet-stream
- name: Upload zip without tool artifact's Certificate
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: ballerina-${{ steps.version-set.outputs.sversion }}.pem
asset_path: ./ballerina-${{ steps.version-set.outputs.sversion }}.pem
asset_content_type: application/octet-stream
- name: Upload zip without tool artifact's Signature
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: ballerina-${{ steps.version-set.outputs.sversion }}.sig
asset_path: ./ballerina-${{ steps.version-set.outputs.sversion }}.sig
asset_content_type: application/octet-stream
- name: Upload Linux deb Installer
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: ballerina-${{ steps.version-set.outputs.longVersion }}-linux-x64.deb
asset_path: installers/linux-deb/target/ballerina-${{ steps.version-set.outputs.longVersion }}-linux-x64.deb
asset_content_type: application/octet-stream
- name: Upload Linux deb Installer's Certificate
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: ballerina-${{ steps.version-set.outputs.longVersion }}-linux-x64.deb.pem
asset_path: ./ballerina-${{ steps.version-set.outputs.longVersion }}-linux-x64.deb.pem
asset_content_type: application/octet-stream
- name: Upload Linux deb Installer's Signature
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: ballerina-${{ steps.version-set.outputs.longVersion }}-linux-x64.deb.sig
asset_path: ./ballerina-${{ steps.version-set.outputs.longVersion }}-linux-x64.deb.sig
asset_content_type: application/octet-stream
- name: Upload Linux rpm Installer
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: ballerina-${{ steps.version-set.outputs.longVersion }}-linux-x64.rpm
asset_path: installers/linux-rpm/rpmbuild/RPMS/x86_64/ballerina-${{ steps.version-set.outputs.longVersion }}-linux-x64.rpm
asset_content_type: application/octet-stream
- name: Upload Linux rpm Installer's Certificate
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: ballerina-${{ steps.version-set.outputs.longVersion }}-linux-x64.rpm.pem
asset_path: ./ballerina-${{ steps.version-set.outputs.longVersion }}-linux-x64.rpm.pem
asset_content_type: application/octet-stream
- name: Upload Linux rpm Installer's Signature
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: ballerina-${{ steps.version-set.outputs.longVersion }}-linux-x64.rpm.sig
asset_path: ./ballerina-${{ steps.version-set.outputs.longVersion }}-linux-x64.rpm.sig
asset_content_type: application/octet-stream
- name: Upload MacOS zip artifacts
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: ballerina-${{ steps.version-set.outputs.longVersion }}-macos.zip
asset_path: ballerina/build/distributions/ballerina-${{ steps.version-set.outputs.longVersion }}-macos.zip
asset_content_type: application/octet-stream
- name: Upload MacOS zip artifact's Certificate
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: ballerina-${{ steps.version-set.outputs.longVersion }}-macos.pem
asset_path: ./ballerina-${{ steps.version-set.outputs.longVersion }}-macos.pem
asset_content_type: application/octet-stream
- name: Upload MacOS zip artifact's Signature
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: ballerina-${{ steps.version-set.outputs.longVersion }}-macos.sig
asset_path: ./ballerina-${{ steps.version-set.outputs.longVersion }}-macos.sig
asset_content_type: application/octet-stream
- name: Upload MacOS-ARM zip artifacts
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: ballerina-${{ steps.version-set.outputs.longVersion }}-macos-arm.zip
asset_path: ballerina/build/distributions/ballerina-${{ steps.version-set.outputs.longVersion }}-macos-arm.zip
asset_content_type: application/octet-stream
- name: Upload MacOS-ARM zip artifact's Certificate
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: ballerina-${{ steps.version-set.outputs.longVersion }}-macos-arm.pem
asset_path: ./ballerina-${{ steps.version-set.outputs.longVersion }}-macos-arm.pem
asset_content_type: application/octet-stream
- name: Upload MacOS-ARM zip artifact's Signature
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: ballerina-${{ steps.version-set.outputs.longVersion }}-macos-arm.sig
asset_path: ./ballerina-${{ steps.version-set.outputs.longVersion }}-macos-arm.sig
asset_content_type: application/octet-stream
- name: Upload Windows zip artifacts
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: ballerina-${{ steps.version-set.outputs.longVersion }}-windows.zip
asset_path: ballerina/build/distributions/ballerina-${{ steps.version-set.outputs.longVersion }}-windows.zip
asset_content_type: application/octet-stream
- name: Upload Windows zip artifact's Certificate
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: ballerina-${{ steps.version-set.outputs.longVersion }}-windows.pem
asset_path: ./ballerina-${{ steps.version-set.outputs.longVersion }}-windows.pem
asset_content_type: application/octet-stream
- name: Upload Windows zip artifact's Signature
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: ballerina-${{ steps.version-set.outputs.longVersion }}-windows.sig
asset_path: ./ballerina-${{ steps.version-set.outputs.longVersion }}-windows.sig
asset_content_type: application/octet-stream
- name: Upload Linux deb Hashes
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: ballerina-${{ steps.version-set.outputs.longVersion }}-linux-x64.deb.sha256
asset_path: ballerina-${{ steps.version-set.outputs.longVersion }}-linux-x64.deb.sha256
asset_content_type: application/octet-stream
- name: Upload Linux rpm Hashes
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: ballerina-${{ steps.version-set.outputs.longVersion }}-linux-x64.rpm.sha256
asset_path: ballerina-${{ steps.version-set.outputs.longVersion }}-linux-x64.rpm.sha256
asset_content_type: application/octet-stream
- name: Upload Ballerina zip Hashes
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: ballerina-${{ steps.version-set.outputs.longVersion }}.zip.sha256
asset_path: ballerina-${{ steps.version-set.outputs.longVersion }}.zip.sha256
asset_content_type: application/octet-stream
- name: Upload ballerina Short Name zip Hashes
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: ballerina-${{ steps.version-set.outputs.sversion }}.zip.sha256
asset_path: ballerina-${{ steps.version-set.outputs.sversion }}.zip.sha256
asset_content_type: application/octet-stream
- name: Install Ballerina DEB
run: sudo dpkg -i installers/linux-deb/target/ballerina-*-linux-x64.deb
- name: Update Installer Test Configs
run: |
DISPLAY_TEXT=${{ steps.version-set.outputs.langVersion }}
SWAN_LAKE_LATEST_VERSION="swan-lake-"+$DISPLAY_TEXT
perl -pi -e "s/^\s*swan-lake-latest-version-display-text=.*/swan-lake-latest-version-display-text=$DISPLAY_TEXT/" ballerina-test-automation/gradle.properties
perl -pi -e "s/^\s*swan-lake-latest-version=.*/swan-lake-latest-version=$SWAN_LAKE_LATEST_VERSION/" ballerina-test-automation/gradle.properties
- name: Run Installer Tests
working-directory: ./ballerina-test-automation/installer-test
run: ./../gradlew build --stacktrace -scan --console=plain --no-daemon -DballerinaInstalled=true
env:
TEST_MODE_ACTIVE: true
- name: Post release PR
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
run: |
curl -fsSL https://github.com/github/hub/raw/master/script/get | bash -s 2.14.1
bin/hub pull-request -m "[Automated] Sync master after "$VERSION" release"
outputs:
project-version: ${{ steps.version-set.outputs.longVersion }}
upload-asset-url: ${{ steps.create_release.outputs.upload_url }}
release-version: ${{ steps.version-set.outputs.taggedVersion }}
lang-version: ${{ steps.version-set.outputs.langVersion }}
macos-installer-build:
name: MacOS Installer Build
needs: publish-release
runs-on: macos-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '17.0.7'
- name: Download MacOS Intaller Zip
run: |
wget https://github.com/ballerina-platform/ballerina-distribution/releases/download/v${{ needs.publish-release.outputs.release-version }}/ballerina-${{ needs.publish-release.outputs.project-version }}-macos.zip
- name: cosign-installer
uses: sigstore/cosign-installer@v3.5.0
- name: Create macos-pkg Installer
id: run_installers_pkg
run: |
cd installers/mac
./build-ballerina-macos-x64.sh -v ${{ needs.publish-release.outputs.project-version }} -p ./../../
echo "Created macos-pkg successfully"
- name: Sign the MacOS installer
run: |
cosign sign-blob installers/mac/target/pkg/ballerina-${{ needs.publish-release.outputs.project-version }}-macos-x64.pkg --output-certificate ballerina-${{ needs.publish-release.outputs.project-version }}-macos-x64.pkg.pem --output-signature ballerina-${{ needs.publish-release.outputs.project-version }}-macos-x64.pkg.sig --yes
- name: Verify the MacOS installer
run: |
cosign verify-blob installers/mac/target/pkg/ballerina-${{ needs.publish-release.outputs.project-version }}-macos-x64.pkg --certificate ballerina-${{ needs.publish-release.outputs.project-version }}-macos-x64.pkg.pem --signature ballerina-${{ needs.publish-release.outputs.project-version }}-macos-x64.pkg.sig --certificate-identity=https://github.com/ballerina-platform/ballerina-distribution/.github/workflows/publish-release.yml@${{ github.ref }} --certificate-oidc-issuer=https://token.actions.githubusercontent.com
- name: Generate Hashes
run: |
openssl dgst -sha256 -out ballerina-${{ needs.publish-release.outputs.project-version }}-macos-x64.pkg.sha256 installers/mac/target/pkg/ballerina-${{ needs.publish-release.outputs.project-version }}-macos-x64.pkg
- name: Upload MacOS pkg Hashes
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
with:
upload_url: ${{ needs.publish-release.outputs.upload-asset-url }}
asset_name: ballerina-${{ needs.publish-release.outputs.project-version }}-macos-x64.pkg.sha256
asset_path: ballerina-${{ needs.publish-release.outputs.project-version }}-macos-x64.pkg.sha256
asset_content_type: application/octet-stream
- name: Upload MacOS pkg Installer
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
with:
upload_url: ${{ needs.publish-release.outputs.upload-asset-url }}
asset_name: ballerina-${{ needs.publish-release.outputs.project-version }}-macos-x64.pkg
asset_path: installers/mac/target/pkg/ballerina-${{ needs.publish-release.outputs.project-version }}-macos-x64.pkg
asset_content_type: application/octet-stream
- name: Upload MacOS installer's Certificate
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
with:
upload_url: ${{ needs.publish-release.outputs.upload-asset-url }}
asset_name: ballerina-${{ needs.publish-release.outputs.project-version }}-macos-x64.pkg.pem
asset_path: ./ballerina-${{ needs.publish-release.outputs.project-version }}-macos-x64.pkg.pem
asset_content_type: application/octet-stream
- name: Upload MacOS installer's Signature
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
with:
upload_url: ${{ needs.publish-release.outputs.upload-asset-url }}
asset_name: ballerina-${{ needs.publish-release.outputs.project-version }}-macos-x64.pkg.sig
asset_path: ./ballerina-${{ needs.publish-release.outputs.project-version }}-macos-x64.pkg.sig
asset_content_type: application/octet-stream
- name: Install Ballerina PKG
run: sudo installer -pkg installers/mac/target/pkg/ballerina-*-macos-x64.pkg -target /
- name: Update Installer Test Configs
run: |
DISPLAY_TEXT=${{ needs.publish-release.outputs.lang-version }}
SWAN_LAKE_LATEST_VERSION="swan-lake-"+$DISPLAY_TEXT
perl -pi -e "s/^\s*swan-lake-latest-version-display-text=.*/swan-lake-latest-version-display-text=$DISPLAY_TEXT/" ballerina-test-automation/gradle.properties
perl -pi -e "s/^\s*swan-lake-latest-version=.*/swan-lake-latest-version=$SWAN_LAKE_LATEST_VERSION/" ballerina-test-automation/gradle.properties
- name: Run Installer Tests
working-directory: ./ballerina-test-automation/installer-test
run: ./../gradlew build --stacktrace -scan --console=plain --no-daemon -DballerinaInstalled=true
env:
TEST_MODE_ACTIVE: true
- name: Download MacOS-ARM Intaller Zip
run: |
wget https://github.com/ballerina-platform/ballerina-distribution/releases/download/v${{ needs.publish-release.outputs.release-version }}/ballerina-${{ needs.publish-release.outputs.project-version }}-macos-arm.zip
- name: Create macos-arm-pkg Installer
id: run_installers_arm_pkg
run: |
cd installers/mac
./build-ballerina-macos-x64.sh -v ${{ needs.publish-release.outputs.project-version }} -p ./../../ -a arm
echo "Created macos-arm-pkg successfully"
- name: Sign the MacOS-ARM installer
run: |
cosign sign-blob installers/mac/target/pkg/ballerina-${{ needs.publish-release.outputs.project-version }}-macos-arm-x64.pkg --output-certificate ballerina-${{ needs.publish-release.outputs.project-version }}-macos-arm-x64.pkg.pem --output-signature ballerina-${{ needs.publish-release.outputs.project-version }}-macos-arm-x64.pkg.sig --yes
- name: Verify the MacOS-ARM installer
run: |
cosign verify-blob installers/mac/target/pkg/ballerina-${{ needs.publish-release.outputs.project-version }}-macos-arm-x64.pkg --certificate ballerina-${{ needs.publish-release.outputs.project-version }}-macos-arm-x64.pkg.pem --signature ballerina-${{ needs.publish-release.outputs.project-version }}-macos-arm-x64.pkg.sig --certificate-identity=https://github.com/ballerina-platform/ballerina-distribution/.github/workflows/publish-release.yml@${{ github.ref }} --certificate-oidc-issuer=https://token.actions.githubusercontent.com
- name: Generate Hashes
run: |
openssl dgst -sha256 -out ballerina-${{ needs.publish-release.outputs.project-version }}-macos-arm-x64.pkg.sha256 installers/mac/target/pkg/ballerina-${{ needs.publish-release.outputs.project-version }}-macos-arm-x64.pkg
- name: Upload MacOS-ARM pkg Hashes
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
with:
upload_url: ${{ needs.publish-release.outputs.upload-asset-url }}
asset_name: ballerina-${{ needs.publish-release.outputs.project-version }}-macos-arm-x64.pkg.sha256
asset_path: ballerina-${{ needs.publish-release.outputs.project-version }}-macos-arm-x64.pkg.sha256
asset_content_type: application/octet-stream
- name: Upload MacOS-ARM pkg Installer
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
with:
upload_url: ${{ needs.publish-release.outputs.upload-asset-url }}
asset_name: ballerina-${{ needs.publish-release.outputs.project-version }}-macos-arm-x64.pkg
asset_path: installers/mac/target/pkg/ballerina-${{ needs.publish-release.outputs.project-version }}-macos-arm-x64.pkg
asset_content_type: application/octet-stream
- name: Upload MacOS-ARM installer's Certificate
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
with:
upload_url: ${{ needs.publish-release.outputs.upload-asset-url }}
asset_name: ballerina-${{ needs.publish-release.outputs.project-version }}-macos-arm-x64.pkg.pem
asset_path: ./ballerina-${{ needs.publish-release.outputs.project-version }}-macos-arm-x64.pkg.pem
asset_content_type: application/octet-stream
- name: Upload MacOS-ARM installer's Signature
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
with:
upload_url: ${{ needs.publish-release.outputs.upload-asset-url }}
asset_name: ballerina-${{ needs.publish-release.outputs.project-version }}-macos-arm-x64.pkg.sig
asset_path: ./ballerina-${{ needs.publish-release.outputs.project-version }}-macos-arm-x64.pkg.sig
asset_content_type: application/octet-stream
windows-installer-build:
name: Windows Installer Build
needs: publish-release
runs-on: windows-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '17.0.7'
- uses: actions/setup-dotnet@v1
with:
dotnet-version: '2.1.x'
- name: Install GUID Generator
run: dotnet tool install -g dotnet-guid --version 0.5.2
- name: Set up Wix toolkit
run: echo "${WIX}bin" >> $GITHUB_PATH
shell: bash
- name: Set cosign-installer
uses: sigstore/cosign-installer@v3.5.0
- name: Download Windows Installer Zip
run: |
echo default login ${{ secrets.BALLERINA_BOT_USERNAME }} password ${{ secrets.BALLERINA_BOT_TOKEN }} >> _netrc
curl --netrc-file _netrc -L -o ballerina-${{ needs.publish-release.outputs.project-version }}-windows.zip https://github.com/ballerina-platform/ballerina-distribution/releases/download/v${{ needs.publish-release.outputs.release-version }}/ballerina-${{ needs.publish-release.outputs.project-version }}-windows.zip
- name: Create windows-msi Installer
id: run_installers_msi
run: |
move installers\windows .\
ren windows w
cd w
.\build-ballerina-windows-x64.bat --version ${{ needs.publish-release.outputs.project-version }} --path .\..\
- name: Sign the Windows installer
run: |
cosign sign-blob w\target\msi\ballerina-${{ needs.publish-release.outputs.project-version }}-windows-x64.msi --output-certificate ballerina-${{ needs.publish-release.outputs.project-version }}-windows-x64.msi.pem --output-signature ballerina-${{ needs.publish-release.outputs.project-version }}-windows-x64.msi.sig --yes
- name: Verify the Windows installer
run: |
cosign verify-blob w\target\msi\ballerina-${{ needs.publish-release.outputs.project-version }}-windows-x64.msi --certificate ballerina-${{ needs.publish-release.outputs.project-version }}-windows-x64.msi.pem --signature ballerina-${{ needs.publish-release.outputs.project-version }}-windows-x64.msi.sig --certificate-identity=https://github.com/ballerina-platform/ballerina-distribution/.github/workflows/publish-release.yml@${{ github.ref }} --certificate-oidc-issuer=https://token.actions.githubusercontent.com
- name: Generate Hashes
run: |
openssl dgst -sha256 -out ballerina-${{ needs.publish-release.outputs.project-version }}-windows-x64.msi.sha256 w\target\msi\ballerina-${{ needs.publish-release.outputs.project-version }}-windows-x64.msi
- name: Upload Windows msi Hashes
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
with:
upload_url: ${{ needs.publish-release.outputs.upload-asset-url }}
asset_name: ballerina-${{ needs.publish-release.outputs.project-version }}-windows-x64.msi.sha256
asset_path: ballerina-${{ needs.publish-release.outputs.project-version }}-windows-x64.msi.sha256
asset_content_type: application/octet-stream
- name: Upload Windows msi Installer
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
with:
upload_url: ${{ needs.publish-release.outputs.upload-asset-url }}
asset_name: ballerina-${{ needs.publish-release.outputs.project-version }}-windows-x64.msi
asset_path: w\target\msi\ballerina-${{ needs.publish-release.outputs.project-version }}-windows-x64.msi
asset_content_type: application/octet-stream
- name: Upload Windows installer's Certificate
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
with:
upload_url: ${{ needs.publish-release.outputs.upload-asset-url }}
asset_name: ballerina-${{ needs.publish-release.outputs.project-version }}-windows-x64.msi.pem
asset_path: ./ballerina-${{ needs.publish-release.outputs.project-version }}-windows-x64.msi.pem
asset_content_type: application/octet-stream
- name: Upload Windows installer's Signature
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
with:
upload_url: ${{ needs.publish-release.outputs.upload-asset-url }}
asset_name: ballerina-${{ needs.publish-release.outputs.project-version }}-windows-x64.msi.sig
asset_path: ./ballerina-${{ needs.publish-release.outputs.project-version }}-windows-x64.msi.sig
asset_content_type: application/octet-stream
- name: Install Ballerina msi
run: msiexec /i w\target\msi\ballerina-${{ needs.publish-release.outputs.project-version }}-windows-x64.msi /quiet /qr
shell: cmd
- name: Update Installer Test Configs
run: |
set DISPLAY_TEXT=${{ needs.publish-release.outputs.lang-version }}
set SWAN_LAKE_LATEST_VERSION=swan-lake-%DISPLAY_TEXT%
perl -pi -e "s/^\s*swan-lake-latest-version-display-text=.*/swan-lake-latest-version-display-text=%DISPLAY_TEXT%/" ballerina-test-automation/gradle.properties
perl -pi -e "s/^\s*swan-lake-latest-version=.*/swan-lake-latest-version=%SWAN_LAKE_LATEST_VERSION%/" ballerina-test-automation/gradle.properties
shell: cmd
- name: Run Installer Tests
working-directory: .\ballerina-test-automation\installer-test
run: |
$env:Path += ";C:\Program Files\Ballerina\bin"
.\..\gradlew build --stacktrace -scan --console=plain --no-daemon -DballerinaInstalled=true