4
4
push :
5
5
tags :
6
6
- ' *'
7
+ workflow_dispatch :
8
+ inputs :
9
+ version :
10
+ description : ' Version number (e.g. v1.2.3)'
11
+ required : true
12
+ default : ' v1.2.3'
7
13
8
14
permissions :
9
15
contents : write
10
16
11
17
jobs :
12
- build :
18
+ release :
13
19
runs-on : windows-latest
14
20
15
21
steps :
@@ -20,42 +26,83 @@ jobs:
20
26
with :
21
27
dotnet-version : ' 8.0.x'
22
28
29
+ # Necessary for signing Windows binaries.
30
+ - name : Setup Java
31
+ uses : actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 # v4.7.0
32
+ with :
33
+ distribution : " zulu"
34
+ java-version : " 11.0"
35
+
23
36
- name : Get version from tag
24
37
id : version
25
38
shell : pwsh
26
39
run : |
27
- $tag = $env:GITHUB_REF -replace 'refs/tags/',''
40
+ $ErrorActionPreference = "Stop"
41
+ if ($env:INPUT_VERSION) {
42
+ $tag = $env:INPUT_VERSION
43
+ } else {
44
+ $tag = $env:GITHUB_REF -replace 'refs/tags/',''
45
+ }
28
46
if ($tag -notmatch '^v\d+\.\d+\.\d+$') {
29
- throw "Tag must be in format v1.2.3"
47
+ throw "Version must be in format v1.2.3, got $tag "
30
48
}
31
49
$version = $tag -replace '^v',''
32
- $assemblyVersion = "$version.0"
33
- echo "VERSION=$version" >> $env:GITHUB_OUTPUT
34
- echo "ASSEMBLY_VERSION=$assemblyVersion" >> $env:GITHUB_OUTPUT
50
+ $assemblyVersion = "$($version).0"
51
+ Add-Content -Path $env:GITHUB_OUTPUT -Value "VERSION=$version"
52
+ Add-Content -Path $env:GITHUB_OUTPUT -Value "ASSEMBLY_VERSION=$assemblyVersion"
53
+ Write-Host "Version: $version"
54
+ Write-Host "Assembly version: $assemblyVersion"
55
+ env :
56
+ INPUT_VERSION : ${{ inputs.version }}
35
57
36
- - name : Build and publish x64
37
- run : |
38
- dotnet publish src/App/App.csproj -c Release -r win-x64 -p:Version=${{ steps.version.outputs.ASSEMBLY_VERSION }} -o publish/x64
39
- dotnet publish src/Vpn.Service/Vpn.Service.csproj -c Release -r win-x64 -p:Version=${{ steps.version.outputs.ASSEMBLY_VERSION }} -o publish/x64
58
+ # Setup GCloud for signing Windows binaries.
59
+ - name : Authenticate to Google Cloud
60
+ id : gcloud_auth
61
+ uses : google-github-actions/auth@71f986410dfbc7added4569d411d040a91dc6935 # v2.1.8
62
+ with :
63
+ workload_identity_provider : ${{ secrets.GCP_CODE_SIGNING_WORKLOAD_ID_PROVIDER }}
64
+ service_account : ${{ secrets.GCP_CODE_SIGNING_SERVICE_ACCOUNT }}
65
+ token_format : " access_token"
40
66
41
- - name : Build and publish arm64
42
- run : |
43
- dotnet publish src/App/App.csproj -c Release -r win-arm64 -p:Version=${{ steps.version.outputs.ASSEMBLY_VERSION }} -o publish/arm64
44
- dotnet publish src/Vpn.Service/Vpn.Service.csproj -c Release -r win-arm64 -p:Version=${{ steps.version.outputs.ASSEMBLY_VERSION }} -o publish/arm64
67
+ - name : Setup GCloud SDK
68
+ uses : google-github-actions/setup-gcloud@77e7a554d41e2ee56fc945c52dfd3f33d12def9a # v2.1.4
45
69
46
- - name : Create ZIP archives
70
+ - name : scripts/Release.ps1
71
+ id : release
47
72
shell : pwsh
48
73
run : |
49
- Compress-Archive -Path "publish/x64/*" -DestinationPath "./publish/CoderDesktop-${{ steps.version.outputs.VERSION }}-x64.zip"
50
- Compress-Archive -Path "publish/arm64/*" -DestinationPath "./publish/CoderDesktop-${{ steps.version.outputs.VERSION }}-arm64.zip"
74
+ $ErrorActionPreference = "Stop"
51
75
52
- - name : Create Release
53
- uses : softprops/action-gh-release@v1
76
+ $env:EV_CERTIFICATE_PATH = Join-Path $env:TEMP "ev_cert.pem"
77
+ $env:JSIGN_PATH = Join-Path $env:TEMP "jsign-6.0.jar"
78
+ Invoke-WebRequest -Uri "https://github.com/ebourg/jsign/releases/download/6.0/jsign-6.0.jar" -OutFile $env:JSIGN_PATH
79
+
80
+ & ./scripts/Release.ps1 `
81
+ -version ${{ steps.version.outputs.VERSION }} `
82
+ -assemblyVersion ${{ steps.version.outputs.ASSEMBLY_VERSION }}
83
+ if ($LASTEXITCODE -ne 0) { throw "Failed to publish" }
84
+ env :
85
+ EV_SIGNING_CERT : ${{ secrets.EV_SIGNING_CERT }}
86
+ EV_KEYSTORE : ${{ secrets.EV_KEYSTORE }}
87
+ EV_KEY : ${{ secrets.EV_KEY }}
88
+ EV_TSA_URL : ${{ secrets.EV_TSA_URL }}
89
+ GCLOUD_ACCESS_TOKEN : ${{ steps.gcloud_auth.outputs.access_token }}
90
+
91
+ - name : Upload artifact
92
+ uses : actions/upload-artifact@v4
93
+ with :
94
+ name : publish
95
+ path : .\publish\
96
+
97
+ - name : Create release
98
+ uses : softprops/action-gh-release@v2
99
+ if : startsWith(github.ref, 'refs/tags/')
54
100
with :
55
- files : |
56
- ./publish/CoderDesktop-${{ steps.version.outputs.VERSION }}-x64.zip
57
- ./publish/CoderDesktop-${{ steps.version.outputs.VERSION }}-arm64.zip
58
101
name : Release ${{ steps.version.outputs.VERSION }}
59
102
generate_release_notes : true
103
+ # We currently only release the bootstrappers, not the MSIs.
104
+ files : |
105
+ ${{ steps.release.outputs.X64_OUTPUT_PATH }}
106
+ ${{ steps.release.outputs.ARM64_OUTPUT_PATH }}
60
107
env :
61
108
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments