-
Notifications
You must be signed in to change notification settings - Fork 1.7k
793 lines (681 loc) · 24.8 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
name: release
on:
workflow_dispatch:
jobs:
# ================================
# macOS
# ================================
osx-build:
name: Build macOS
runs-on: macos-latest
environment: release
strategy:
matrix:
runtime: [ osx-x64, osx-arm64 ]
steps:
- uses: actions/checkout@v3
- name: Set up dotnet
uses: actions/setup-dotnet@v3.2.0
with:
dotnet-version: 6.0.201
- name: Install dependencies
run: dotnet restore
- name: Build
run: |
dotnet build src/osx/Installer.Mac/*.csproj \
--configuration=MacRelease --no-self-contained \
--runtime=${{ matrix.runtime }}
- name: Run macOS unit tests
run: |
dotnet test --configuration=MacRelease
- name: Lay out payload and symbols
run: |
src/osx/Installer.Mac/layout.sh \
--configuration=MacRelease --output=payload \
--symbol-output=symbols --runtime=${{ matrix.runtime }}
- name: Create keychain
env:
CERT_BASE64: ${{ secrets.DEVELOPER_CERTIFICATE_BASE64 }}
CERT_PASSPHRASE: ${{ secrets.DEVELOPER_CERTIFICATE_PASSWORD }}
run: |
security create-keychain -p pwd $RUNNER_TEMP/buildagent.keychain
security default-keychain -s $RUNNER_TEMP/buildagent.keychain
security unlock-keychain -p pwd $RUNNER_TEMP/buildagent.keychain
echo $CERT_BASE64 | base64 -D > $RUNNER_TEMP/cert.p12
security import $RUNNER_TEMP/cert.p12 -k $RUNNER_TEMP/buildagent.keychain -P $CERT_PASSPHRASE -T /usr/bin/codesign
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k pwd $RUNNER_TEMP/buildagent.keychain
- name: Developer sign
env:
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
run: |
.github/run_developer_signing.sh payload $APPLE_TEAM_ID $GITHUB_WORKSPACE/src/osx/Installer.Mac/entitlements.xml
- name: Upload macOS artifacts
uses: actions/upload-artifact@v3
with:
name: tmp.${{ matrix.runtime }}-build
path: |
payload
symbols
osx-payload-sign:
name: Sign macOS payload
# ESRP service requires signing to run on Windows
runs-on: windows-latest
environment: release
strategy:
matrix:
runtime: [ osx-x64, osx-arm64 ]
needs: osx-build
steps:
- uses: actions/checkout@v3
- name: Download payload
uses: actions/download-artifact@v3
with:
name: tmp.${{ matrix.runtime }}-build
- name: Zip unsigned payload
shell: pwsh
run: |
Compress-Archive -Path payload payload/payload.zip
cd payload
Get-ChildItem -Exclude payload.zip | Remove-Item -Recurse -Force
- uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Set up ESRP client
shell: pwsh
env:
AZURE_VAULT: ${{ secrets.AZURE_VAULT }}
AUTH_CERT: ${{ secrets.AZURE_VAULT_AUTH_CERT_NAME }}
REQUEST_SIGNING_CERT: ${{ secrets.AZURE_VAULT_REQUEST_SIGNING_CERT_NAME }}
run: |
.github\set_up_esrp.ps1
- name: Run ESRP client
shell: pwsh
env:
AZURE_AAD_ID: ${{ secrets.AZURE_AAD_ID }}
APPLE_KEY_CODE: ${{ secrets.APPLE_KEY_CODE }}
APPLE_SIGNING_OP_CODE: ${{ secrets.APPLE_SIGNING_OPERATION_CODE }}
run: |
python .github\run_esrp_signing.py payload `
$env:APPLE_KEY_CODE $env:APPLE_SIGNING_OP_CODE `
--params 'Hardening' '--options=runtime'
- name: Unzip signed payload
shell: pwsh
run: |
Expand-Archive signed/payload.zip -DestinationPath signed
Remove-Item signed/payload.zip
- name: Upload signed payload
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.runtime }}-payload-sign
path: |
signed
osx-pack:
name: Package macOS payload
runs-on: macos-latest
strategy:
matrix:
runtime: [ osx-x64, osx-arm64 ]
needs: osx-payload-sign
steps:
- uses: actions/checkout@v3
- name: Set version environment variable
run: echo "VERSION=$(cat VERSION | sed -E 's/.[0-9]+$//')" >> $GITHUB_ENV
- name: Set up dotnet
uses: actions/setup-dotnet@v3.2.0
with:
dotnet-version: 6.0.201
- name: Download signed payload
uses: actions/download-artifact@v3
with:
name: ${{ matrix.runtime }}-payload-sign
- name: Create component package
run: |
src/osx/Installer.Mac/pack.sh --payload=payload \
--version=$VERSION \
--output=components/com.microsoft.gitcredentialmanager.component.pkg
- name: Create product archive
run: |
src/osx/Installer.Mac/dist.sh --package-path=components \
--version=$VERSION --runtime=${{ matrix.runtime }} \
--output=pkg/gcm-${{ matrix.runtime }}-$VERSION.pkg || exit 1
- name: Upload package
uses: actions/upload-artifact@v3
with:
name: tmp.${{ matrix.runtime }}-pack
path: |
pkg
osx-sign:
name: Sign and notarize macOS package
# ESRP service requires signing to run on Windows
runs-on: windows-latest
environment: release
strategy:
matrix:
runtime: [ osx-x64, osx-arm64 ]
needs: osx-pack
steps:
- uses: actions/checkout@v3
- name: Download unsigned package
uses: actions/download-artifact@v3
with:
name: tmp.${{ matrix.runtime }}-pack
path: pkg
- name: Zip unsigned package
shell: pwsh
run: |
Compress-Archive -Path pkg/*.pkg pkg/gcm-pkg.zip
cd pkg
Get-ChildItem -Exclude gcm-pkg.zip | Remove-Item -Recurse -Force
- uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Set up ESRP client
shell: pwsh
env:
AZURE_VAULT: ${{ secrets.AZURE_VAULT }}
AUTH_CERT: ${{ secrets.AZURE_VAULT_AUTH_CERT_NAME }}
REQUEST_SIGNING_CERT: ${{ secrets.AZURE_VAULT_REQUEST_SIGNING_CERT_NAME }}
run: |
.github\set_up_esrp.ps1
- name: Sign package
shell: pwsh
env:
AZURE_AAD_ID: ${{ secrets.AZURE_AAD_ID }}
APPLE_KEY_CODE: ${{ secrets.APPLE_KEY_CODE }}
APPLE_SIGNING_OP_CODE: ${{ secrets.APPLE_SIGNING_OPERATION_CODE }}
run: |
python .github\run_esrp_signing.py pkg $env:APPLE_KEY_CODE $env:APPLE_SIGNING_OP_CODE
- name: Unzip signed package
shell: pwsh
run: |
mkdir unsigned
Expand-Archive -LiteralPath signed\gcm-pkg.zip -DestinationPath .\unsigned -Force
Remove-Item signed\gcm-pkg.zip -Force
- name: Notarize signed package
shell: pwsh
env:
AZURE_AAD_ID: ${{ secrets.AZURE_AAD_ID }}
APPLE_KEY_CODE: ${{ secrets.APPLE_KEY_CODE }}
APPLE_NOTARIZATION_OP_CODE: ${{ secrets.APPLE_NOTARIZATION_OPERATION_CODE }}
run: |
python .github\run_esrp_signing.py unsigned $env:APPLE_KEY_CODE $env:APPLE_NOTARIZATION_OP_CODE --params 'BundleId' 'com.microsoft.gitcredentialmanager'
- name: Publish signed package
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.runtime }}-sign
path: signed/*.pkg
# ================================
# Windows
# ================================
win-sign:
name: Build and Sign Windows
runs-on: windows-latest
environment: release
steps:
- uses: actions/checkout@v3
- name: Set up dotnet
uses: actions/setup-dotnet@v3.2.0
with:
dotnet-version: 6.0.201
- name: Install dependencies
run: dotnet restore
- name: Build
run: |
dotnet build --configuration=WindowsRelease
- name: Run Windows unit tests
run: |
dotnet test --configuration=WindowsRelease
- name: Lay out Windows payload and symbols
shell: pwsh
run: |
cd src/windows/Installer.Windows/
./layout.ps1 -Configuration WindowsRelease -Output payload -SymbolOutput symbols
mkdir unsigned-payload
Get-ChildItem -Path payload/* -Include *.exe, *.dll | Move-Item -Destination unsigned-payload
- uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Set up ESRP client
shell: pwsh
env:
AZURE_VAULT: ${{ secrets.AZURE_VAULT }}
AUTH_CERT: ${{ secrets.AZURE_VAULT_AUTH_CERT_NAME }}
REQUEST_SIGNING_CERT: ${{ secrets.AZURE_VAULT_REQUEST_SIGNING_CERT_NAME }}
run: |
.github\set_up_esrp.ps1
- name: Run ESRP client for unsigned payload
shell: pwsh
env:
AZURE_AAD_ID: ${{ secrets.AZURE_AAD_ID }}
WINDOWS_KEY_CODE: ${{ secrets.WINDOWS_KEY_CODE }}
WINDOWS_OP_CODE: ${{ secrets.WINDOWS_OPERATION_CODE }}
run: |
python .github\run_esrp_signing.py `
src/windows/Installer.Windows/unsigned-payload `
$env:WINDOWS_KEY_CODE $env:WINDOWS_OP_CODE `
--params 'OpusName' 'Microsoft' `
'OpusInfo' 'http://www.microsoft.com' `
'FileDigest' '/fd "SHA256"' 'PageHash' '/NPH' `
'TimeStamp' '/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256'
- name: Lay out signed payload
shell: pwsh
run: |
mkdir signed-payload
Move-Item -Path signed/* -Destination signed-payload
# ESRP will not sign the *.exe.config or NOTICE files, but they are needed to build the installers.
# Due to this, we copy them after signing.
Get-ChildItem -Path src/windows/Installer.Windows/payload/* -Include *.exe.config, NOTICE | Move-Item -Destination signed-payload
Remove-Item signed -Recurse -Force
- name: Build with signed payload
shell: pwsh
run: |
dotnet build src/windows/Installer.Windows /p:PayloadPath=$env:GITHUB_WORKSPACE/signed-payload /p:NoLayout=true --configuration=WindowsRelease
- name: Run ESRP client for installers
shell: pwsh
env:
AZURE_AAD_ID: ${{ secrets.AZURE_AAD_ID }}
WINDOWS_KEY_CODE: ${{ secrets.WINDOWS_KEY_CODE }}
WINDOWS_OP_CODE: ${{ secrets.WINDOWS_OPERATION_CODE }}
run: |
python .github\run_esrp_signing.py `
.\out\windows\Installer.Windows\bin\WindowsRelease\net472 `
$env:WINDOWS_KEY_CODE `
$env:WINDOWS_OP_CODE `
--params 'OpusName' 'Microsoft' `
'OpusInfo' 'http://www.microsoft.com' `
'FileDigest' '/fd "SHA256"' 'PageHash' '/NPH' `
'TimeStamp' '/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256'
- name: Publish final artifacts
uses: actions/upload-artifact@v3
with:
name: win-sign
path: |
signed
signed-payload
src/windows/Installer.Windows/symbols
# ================================
# Linux
# ================================
linux-build:
name: Build Linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3.2.0
with:
dotnet-version: 6.0.201
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration=LinuxRelease
- name: Lay out
run: |
mkdir -p linux-build/deb linux-build/tar
mv out/linux/Packaging.Linux/Release/deb/*.deb linux-build/deb
mv out/linux/Packaging.Linux/Release/tar/*.tar.gz linux-build/tar
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: linux-build
path: |
linux-build
linux-sign:
name: Sign Linux tarball and Debian package
needs: linux-build
# ESRP service requires signing to run on Windows
runs-on: windows-latest
environment: release
steps:
- uses: actions/checkout@v3
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: linux-build
- name: Remove symbols
run: |
rm tar/*symbols*
- uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Set up ESRP client
shell: pwsh
env:
AZURE_VAULT: ${{ secrets.AZURE_VAULT }}
AUTH_CERT: ${{ secrets.AZURE_VAULT_AUTH_CERT_NAME }}
REQUEST_SIGNING_CERT: ${{ secrets.AZURE_VAULT_REQUEST_SIGNING_CERT_NAME }}
run: |
.github\set_up_esrp.ps1
- name: Run ESRP client
shell: pwsh
env:
AZURE_AAD_ID: ${{ secrets.AZURE_AAD_ID }}
LINUX_KEY_CODE: ${{ secrets.LINUX_KEY_CODE }}
LINUX_OP_CODE: ${{ secrets.LINUX_OPERATION_CODE }}
run: |
python .github/run_esrp_signing.py deb $env:LINUX_KEY_CODE $env:LINUX_OP_CODE
python .github/run_esrp_signing.py tar $env:LINUX_KEY_CODE $env:LINUX_OP_CODE
- name: Re-name tarball signature file
shell: bash
run: |
signaturepath=$(find signed/*.tar.gz)
mv "$signaturepath" "${signaturepath%.tar.gz}.asc"
- name: Upload signed tarball and Debian package
uses: actions/upload-artifact@v3
with:
name: linux-sign
path: |
signed
# ================================
# .NET Tool
# ================================
dotnet-tool-build:
name: Build .NET tool
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3.2.0
with:
dotnet-version: 6.0.201
- name: Build .NET tool
run: |
src/shared/DotnetTool/layout.sh --configuration=Release
- name: Upload .NET tool artifacts
uses: actions/upload-artifact@v3
with:
name: tmp.dotnet-tool-build
path: |
out/shared/DotnetTool/nupkg/Release
dotnet-tool-payload-sign:
name: Sign .NET tool payload
# ESRP service requires signing to run on Windows
runs-on: windows-latest
environment: release
needs: dotnet-tool-build
steps:
- uses: actions/checkout@v3
- name: Download payload
uses: actions/download-artifact@v3
with:
name: tmp.dotnet-tool-build
- name: Zip unsigned payload
shell: pwsh
run: |
Compress-Archive -Path payload payload/payload.zip
cd payload
Get-ChildItem -Exclude payload.zip | Remove-Item -Recurse -Force
- uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Set up ESRP client
shell: pwsh
env:
AZURE_VAULT: ${{ secrets.AZURE_VAULT }}
AUTH_CERT: ${{ secrets.AZURE_VAULT_AUTH_CERT_NAME }}
REQUEST_SIGNING_CERT: ${{ secrets.AZURE_VAULT_REQUEST_SIGNING_CERT_NAME }}
run: |
.github\set_up_esrp.ps1
- name: Run ESRP client
shell: pwsh
env:
AZURE_AAD_ID: ${{ secrets.AZURE_AAD_ID }}
NUGET_KEY_CODE: ${{ secrets.NUGET_KEY_CODE }}
NUGET_OPERATION_CODE: ${{ secrets.NUGET_OPERATION_CODE }}
run: |
python .github\run_esrp_signing.py payload `
$env:NUGET_KEY_CODE $env:NUGET_OPERATION_CODE
- name: Lay out signed payload, images, and symbols
shell: bash
run: |
mkdir dotnet-tool-payload-sign
rm -rf payload
mv images payload.sym -t dotnet-tool-payload-sign
unzip signed/payload.zip -d dotnet-tool-payload-sign
- name: Upload signed payload
uses: actions/upload-artifact@v3
with:
name: dotnet-tool-payload-sign
path: |
dotnet-tool-payload-sign
dotnet-tool-pack:
name: Package .NET tool
runs-on: ubuntu-latest
needs: dotnet-tool-payload-sign
steps:
- uses: actions/checkout@v3
- name: Set version environment variable
run: echo "VERSION=$(cat VERSION | sed -E 's/.[0-9]+$//')" >> $GITHUB_ENV
- uses: actions/checkout@v3
- name: Download signed payload
uses: actions/download-artifact@v3
with:
name: dotnet-tool-payload-sign
path: signed
- name: Setup .NET
uses: actions/setup-dotnet@v3.2.0
with:
dotnet-version: 6.0.201
- name: Package tool
run: |
src/shared/DotnetTool/pack.sh --configuration=Release \
--version=$VERSION --publish-dir=$(pwd)/signed
- name: Upload unsigned package
uses: actions/upload-artifact@v3
with:
name: tmp.dotnet-tool-package-unsigned
path: |
out/shared/DotnetTool/nupkg/Release/*.nupkg
dotnet-tool-sign:
name: Sign .NET tool package
# ESRP service requires signing to run on Windows
runs-on: windows-latest
environment: release
needs: dotnet-tool-pack
steps:
- uses: actions/checkout@v3
- name: Download unsigned package
uses: actions/download-artifact@v3
with:
name: tmp.dotnet-tool-package-unsigned
path: nupkg
- name: Zip unsigned package
shell: pwsh
run: |
Compress-Archive -Path nupkg/*.nupkg nupkg/gcm-nupkg.zip
cd nupkg
Get-ChildItem -Exclude gcm-nupkg.zip | Remove-Item -Recurse -Force
- uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Set up ESRP client
shell: pwsh
env:
AZURE_VAULT: ${{ secrets.AZURE_VAULT }}
AUTH_CERT: ${{ secrets.AZURE_VAULT_AUTH_CERT_NAME }}
REQUEST_SIGNING_CERT: ${{ secrets.AZURE_VAULT_REQUEST_SIGNING_CERT_NAME }}
run: |
.github\set_up_esrp.ps1
- name: Sign package
shell: pwsh
env:
AZURE_AAD_ID: ${{ secrets.AZURE_AAD_ID }}
NUGET_KEY_CODE: ${{ secrets.NUGET_KEY_CODE }}
NUGET_OPERATION_CODE: ${{ secrets.NUGET_OPERATION_CODE }}
run: |
python .github\run_esrp_signing.py nupkg $env:NUGET_KEY_CODE $env:NUGET_OPERATION_CODE
- name: Unzip signed package
shell: pwsh
run: |
Expand-Archive -LiteralPath signed\gcm-nupkg.zip -DestinationPath .\signed -Force
Remove-Item signed\gcm-nupkg.zip -Force
- name: Publish signed package
uses: actions/upload-artifact@v3
with:
name: dotnet-tool-sign
path: signed/*.nupkg
# ================================
# Validate
# ================================
validate:
name: Validate installers
strategy:
matrix:
component:
- os: ubuntu-latest
artifact: linux-sign
command: git-credential-manager
description: debian
- os: ubuntu-latest
artifact: linux-build
command: git-credential-manager
description: tarball
- os: macos-latest
artifact: osx-x64-sign
command: git-credential-manager
description: osx-x64
- os: windows-latest
artifact: win-sign
# Even when a standalone GCM version is installed, GitHub actions
# runners still only recognize the version bundled with Git for
# Windows due to its placement on the PATH. For this reason, we use
# the full path to our installation to validate the Windows version.
command: "$PROGRAMFILES (x86)/Git Credential Manager/git-credential-manager.exe"
description: windows
- os: ubuntu-latest
artifact: dotnet-tool-sign
command: git-credential-manager
description: dotnet-tool
runs-on: ${{ matrix.component.os }}
needs: [ osx-sign, win-sign, linux-sign, dotnet-tool-sign ]
steps:
- uses: actions/checkout@v3
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: ${{ matrix.component.artifact }}
- name: Install Windows
if: contains(matrix.component.description, 'windows')
shell: pwsh
run: |
$exePaths = Get-ChildItem -Path ./signed/*.exe | %{$_.FullName}
foreach ($exePath in $exePaths)
{
Start-Process -Wait -FilePath "$exePath" -ArgumentList "/SILENT /VERYSILENT /NORESTART"
}
- name: Install Linux (Debian package)
if: contains(matrix.component.description, 'debian')
run: |
debpath=$(find ./*.deb)
sudo apt install $debpath
"${{ matrix.component.command }}" configure
- name: Install Linux (tarball)
if: contains(matrix.component.description, 'tarball')
run: |
# Ensure we find only the source tarball, not the symbols
tarpath=$(find ./tar -name '*[[:digit:]].tar.gz')
tar -xvf $tarpath -C /usr/local/bin
"${{ matrix.component.command }}" configure
- name: Install macOS
if: contains(matrix.component.description, 'osx-x64')
run: |
# Only validate x64, given arm64 agents are not available
pkgpath=$(find ./*.pkg)
sudo installer -pkg $pkgpath -target /
- name: Install .NET tool
if: contains(matrix.component.description, 'dotnet-tool')
run: |
nupkgpath=$(find ./*.nupkg)
dotnet tool install -g --add-source $(dirname "$nupkgpath") git-credential-manager
"${{ matrix.component.command }}" configure
- name: Validate
shell: bash
run: |
"${{ matrix.component.command }}" --version | sed 's/+.*//' >actual
cat VERSION | sed -E 's/.[0-9]+$//' >expect
cmp expect actual || exit 1
# ================================
# Publish
# ================================
create-github-release:
name: Publish GitHub draft release
runs-on: ubuntu-latest
environment: release
needs: [ validate ]
steps:
- uses: actions/checkout@v3
- name: Set version environment variable
run: |
# Remove the "revision" portion of the version
echo "VERSION=$(cat VERSION | sed -E 's/.[0-9]+$//')" >> $GITHUB_ENV
- name: Set up dotnet
uses: actions/setup-dotnet@v3.2.0
with:
dotnet-version: 6.0.201
- name: Download artifacts
uses: actions/download-artifact@v3
- name: Archive macOS payload and symbols
run: |
mkdir osx-payload-and-symbols
tar -C osx-x64-payload-sign -czf osx-payload-and-symbols/gcm-osx-x64-$VERSION.tar.gz .
tar -C tmp.osx-x64-build/symbols -czf osx-payload-and-symbols/gcm-osx-x64-$VERSION-symbols.tar.gz .
tar -C osx-arm64-payload-sign -czf osx-payload-and-symbols/gcm-osx-arm64-$VERSION.tar.gz .
tar -C tmp.osx-arm64-build/symbols -czf osx-payload-and-symbols/gcm-osx-arm64-$VERSION-symbols.tar.gz .
- name: Archive Windows payload and symbols
run: |
mkdir win-x86-payload-and-symbols
zip -jr win-x86-payload-and-symbols/gcm-win-x86-$VERSION.zip win-sign/signed-payload
zip -jr win-x86-payload-and-symbols/gcm-win-x86-$VERSION-symbols.zip win-sign/src/windows/Installer.Windows/symbols
- uses: actions/github-script@v6
with:
script: |
const fs = require('fs');
const path = require('path');
const version = process.env.VERSION
var releaseMetadata = {
owner: context.repo.owner,
repo: context.repo.repo
};
// Create the release
var tagName = `v${version}`;
var createdRelease = await github.rest.repos.createRelease({
...releaseMetadata,
draft: true,
tag_name: tagName,
name: `GCM ${version}`
});
releaseMetadata.release_id = createdRelease.data.id;
// Uploads contents of directory to the release created above
async function uploadDirectoryToRelease(directory, includeExtensions=[]) {
return fs.promises.readdir(directory)
.then(async(files) => Promise.all(
files.filter(file => {
return includeExtensions.length==0 || includeExtensions.includes(path.extname(file).toLowerCase());
})
.map(async (file) => {
var filePath = path.join(directory, file);
github.rest.repos.uploadReleaseAsset({
...releaseMetadata,
name: file,
headers: {
"content-length": (await fs.promises.stat(filePath)).size
},
data: fs.createReadStream(filePath)
});
}))
);
}
await Promise.all([
// Upload Windows artifacts
uploadDirectoryToRelease('win-sign/signed'),
uploadDirectoryToRelease('win-x86-payload-and-symbols'),
// Upload macOS artifacts
uploadDirectoryToRelease('osx-x64-sign'),
uploadDirectoryToRelease('osx-arm64-sign'),
uploadDirectoryToRelease('osx-payload-and-symbols'),
// Upload Linux artifacts
uploadDirectoryToRelease('linux-build/tar'),
uploadDirectoryToRelease('linux-sign'),
// Upload .NET tool package
uploadDirectoryToRelease('dotnet-tool-sign'),
]);