@@ -23,11 +23,18 @@ import { existsSync, rmSync, writeFileSync } from 'fs'
23
23
import { getVersion } from '../app/package-info'
24
24
import { rename } from 'fs/promises'
25
25
import { join } from 'path'
26
+ import { assertNonNullable } from '../app/src/lib/fatal-error'
26
27
27
28
const distPath = getDistPath ( )
28
29
const productName = getProductName ( )
29
30
const outputDir = getDistRoot ( )
30
31
32
+ const assertExistsSync = ( path : string ) => {
33
+ if ( ! existsSync ( path ) ) {
34
+ throw new Error ( `Expected ${ path } to exist` )
35
+ }
36
+ }
37
+
31
38
if ( process . platform === 'darwin' ) {
32
39
packageOSX ( )
33
40
} else if ( process . platform === 'win32' ) {
@@ -107,8 +114,23 @@ function packageWindows() {
107
114
}
108
115
109
116
if ( isGitHubActions ( ) && isPublishable ( ) ) {
110
- const certificatePath = path . join ( __dirname , 'windows-certificate.pfx' )
111
- options . signWithParams = `/f ${ certificatePath } /p ${ process . env . WINDOWS_CERT_PASSWORD } /tr http://timestamp.digicert.com /td sha256 /fd sha256`
117
+ assertNonNullable ( process . env . RUNNER_TEMP , 'Missing RUNNER_TEMP env var' )
118
+
119
+ const acsPath = join ( process . env . RUNNER_TEMP , 'acs' )
120
+ const dlibPath = join ( acsPath , 'bin' , 'x64' , 'Azure.CodeSigning.Dlib.dll' )
121
+
122
+ assertExistsSync ( dlibPath )
123
+
124
+ const metadataPath = join ( acsPath , 'metadata.json' )
125
+ const acsMetadata = {
126
+ Endpoint : 'https://eus.codesigning.azure.net/' ,
127
+ CodeSigningAccountName : 'github-desktop' ,
128
+ CertificateProfileName : 'desktop' ,
129
+ CorrelationId : `${ process . env . GITHUB_SERVER_URL } /${ process . env . GITHUB_REPOSITORY } /actions/runs/${ process . env . GITHUB_RUN_ID } ` ,
130
+ }
131
+ writeFileSync ( metadataPath , JSON . stringify ( acsMetadata ) )
132
+
133
+ options . signWithParams = `/v /fd SHA256 /tr "http://timestamp.acs.microsoft.com" /td SHA256 /dlib "${ dlibPath } " /dmdf "${ metadataPath } "`
112
134
}
113
135
114
136
console . log ( 'Packaging for Windows…' )
0 commit comments