Skip to content

Commit

Permalink
Update build process to generate dev certificate and use environment …
Browse files Browse the repository at this point in the history
…variables for certificate path and password
  • Loading branch information
Thavarshan committed Aug 31, 2024
1 parent 951cd26 commit 97f8125
Showing 1 changed file with 10 additions and 34 deletions.
44 changes: 10 additions & 34 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,55 +23,31 @@ jobs:
choco install microsoft-build-tools -y
shell: pwsh

- name: Verify makeappx.exe
- name: Generate Dev Certificate, Install Dependencies, and Build App
run: |
# Verify makeappx.exe
$makeappxPath = 'C:\Program Files (x86)\Windows Kits\10\App Certification Kit\makeappx.exe'
if (Test-Path $makeappxPath) {
echo "makeappx.exe found at $makeappxPath"
echo "WINDOWS_KIT_PATH=C:\Program Files (x86)\Windows Kits\10\App Certification Kit" >> $env:GITHUB_ENV
$env:WINDOWS_KIT_PATH="C:\Program Files (x86)\Windows Kits\10\App Certification Kit"
} else {
Write-Error "makeappx.exe not found."
exit 1
}
shell: pwsh
- name: Generate Dev Certificate
run: |
# Generate Dev Certificate
$certPassword = [guid]::NewGuid().ToString()
$certPath = "$(Get-Location)\devcert.pfx"
$cert = New-SelfSignedCertificate -DnsName "CN=DevCert" -CertStoreLocation "Cert:\CurrentUser\My" -NotAfter (Get-Date).AddYears(1)
Export-PfxCertificate -Cert $cert -FilePath $certPath -Password (ConvertTo-SecureString -String $certPassword -Force -AsPlainText)
echo "CERT_PATH=$certPath" >> "$GITHUB_ENV"
echo "CERT_PASSWORD=$certPassword" >> "$GITHUB_ENV"
echo "Generated CERT_PATH: $certPath"
echo "Generated CERT_PASSWORD: $certPassword"
shell: pwsh
- name: Verify CERT_PATH and CERT_PASSWORD
run: |
if (-not $env:CERT_PATH) {
Write-Error "CERT_PATH is not set."
exit 1
}
if (-not $env:CERT_PASSWORD) {
Write-Error "CERT_PASSWORD is not set."
exit 1
}
echo "CERT_PATH is set to $env:CERT_PATH"
echo "CERT_PASSWORD is set to $env:CERT_PASSWORD"
shell: pwsh
# Install dependencies
npm install
- name: Print Windows Kit Path
run: |
echo "Windows Kit Path: $env:WINDOWS_KIT_PATH"
# Build app
$env:CERT_PATH=$certPath
$env:CERT_PASSWORD=$certPassword
npm run make
shell: pwsh

- name: Install dependencies
run: npm install

- name: Build app
run: npm run make
env:
WINDOWS_KIT_PATH: ${{ env.WINDOWS_KIT_PATH }}
CERT_PATH: ${{ env.CERT_PATH }}
CERT_PASSWORD: ${{ env.CERT_PASSWORD }}

0 comments on commit 97f8125

Please sign in to comment.