From 98dfd5c816d4cb2a90512da465601e98729aae7e Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Fri, 9 Aug 2024 07:52:49 +1000 Subject: [PATCH] Update Windows configuration to remove AppX ambiguity (#3239) --- .buildkite/commands/package_windows.ps1 | 6 +++--- Makefile | 12 ++++++------ electron-builder-appx.json | 8 +++----- electron-builder.json | 8 -------- 4 files changed, 12 insertions(+), 22 deletions(-) diff --git a/.buildkite/commands/package_windows.ps1 b/.buildkite/commands/package_windows.ps1 index 406ba2812..5000a1d2e 100644 --- a/.buildkite/commands/package_windows.ps1 +++ b/.buildkite/commands/package_windows.ps1 @@ -26,7 +26,7 @@ If (Test-Path $certPath) { [System.Environment]::SetEnvironmentVariable('CSC_LINK', $certPath, [System.EnvironmentVariableTarget]::Machine) Write-Host "Environment variable CSC_LINK set to $certPath" } else { - Write-Host "[!] certificate.pfx file does not exist." + Write-Host "[!] Certificate file does not exist at given path $certPath." Exit 1 } @@ -38,8 +38,8 @@ Import-PfxCertificate -FilePath $certPath -CertStoreLocation Cert:\LocalMachine\ Write-Host "--- :windows: Installing make" choco install make -Write-Host "--- :npm: Installing dependencies" -npm ci --legacy-peer-deps +bash ".\.buildkite\commands\install_node_dependencies.sh" +If ($LastExitCode -ne 0) { Exit $LastExitCode } Write-Host "--- :lock_with_ink_pen: Decrypting secrets" make decrypt_conf diff --git a/Makefile b/Makefile index 77c6f5363..aec58b57c 100644 --- a/Makefile +++ b/Makefile @@ -141,14 +141,14 @@ package: build-if-changed .PHONY: package-win32 package-win32: - @echo Packaging .exe... + @echo "Packaging exe..." @npx electron-builder --win -p $(PUBLISH) -ifeq ($(IS_WINDOWS),true) - @echo Packaging .appx as well... + # Note: the configuration required to generate a code signed exe via the `nsis` target will conflict with the `appx` configuration. + # In practice, "certificateSubjectName": "Automattic, Inc." is required to sign the exe, but if that setting is present and so are the `appx` settings, there will be a failure. + # Hence the need for a separate configuration here. + # See also in https://github.com/electron-userland/electron-builder/issues/6698 + @echo "Packaging appx — with dedicated configuration to work around code signing conflicts..." @npx electron-builder --win -p $(PUBLISH) --config=./electron-builder-appx.json -else - @echo Skipping packaging .appx because we are not running on a Windows machine. -endif .PHONY: package-osx package-osx: build-if-changed diff --git a/electron-builder-appx.json b/electron-builder-appx.json index 21178a3cc..072743c42 100644 --- a/electron-builder-appx.json +++ b/electron-builder-appx.json @@ -2,8 +2,8 @@ "productName": "Simplenote", "appId": "com.automattic.simplenote", "directories": { - "output": "release", - "buildResources": "resources" + "output": "./release", + "buildResources": "./resources" }, "files": ["desktop", "dist", "shared"], "win": { @@ -29,7 +29,5 @@ "name": "simplenote", "schemes": ["simplenote"] } - ], - "afterSign": "./after_sign_hook.js", - "afterAllArtifactBuild": "./after_sign_hook.js" + ] } diff --git a/electron-builder.json b/electron-builder.json index dfd98c4f3..8a5bdd915 100644 --- a/electron-builder.json +++ b/electron-builder.json @@ -54,17 +54,9 @@ { "target": "nsis", "arch": ["ia32", "x64"] - }, - { - "target": "appx", - "arch": ["ia32", "x64"] } ] }, - "appx": { - "backgroundColor": "transparent", - "showNameOnTiles": true - }, "nsis": { "artifactName": "Simplenote-win-${version}-${arch}.${ext}", "deleteAppDataOnUninstall": true,