Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge Main to Dev (after adding Windows Code Signing) #374

Merged
merged 49 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
c04b331
Merge pull request #334 from HASEL-UZH/dev
SRichner Oct 29, 2024
5dc0eec
Merge pull request #336 from HASEL-UZH/dev
SRichner Oct 29, 2024
1c5212f
Merge pull request #337 from HASEL-UZH/dev
SRichner Oct 29, 2024
5b09f6b
Merge pull request #338 from HASEL-UZH/dev
SRichner Oct 29, 2024
3708999
Merge pull request #339 from HASEL-UZH/dev
SRichner Oct 29, 2024
20f5998
Merge pull request #340 from HASEL-UZH/dev
SRichner Oct 29, 2024
a4f4fa4
Merge pull request #341 from HASEL-UZH/dev
SRichner Oct 29, 2024
a6c2d07
Merge pull request #349 from HASEL-UZH/dev
casaout Jan 24, 2025
2efca3c
Merge pull request #351 from HASEL-UZH/dev
casaout Jan 24, 2025
a971f02
Merge pull request #353 from HASEL-UZH/dev
casaout Jan 24, 2025
c44d490
[#350] attempting windows code signing
casaout Jan 24, 2025
31e240c
Merge pull request #354 from HASEL-UZH/350-win-code-sign
casaout Jan 24, 2025
1d35297
[#350] updating electron-builder
casaout Jan 24, 2025
bc7e331
Merge pull request #355 from HASEL-UZH/350-win-code-sign
casaout Jan 24, 2025
9191d87
[#350] trying newer version of electron builder
casaout Jan 24, 2025
9dec13c
Merge pull request #356 from HASEL-UZH/350-win-code-sign
casaout Jan 24, 2025
5622d5c
[#350] fixing notarize
casaout Jan 24, 2025
b84e3c0
Merge pull request #357 from HASEL-UZH/350-win-code-sign
casaout Jan 24, 2025
dd5cee6
[#350] fixing macos notarization attempt 2
casaout Jan 24, 2025
773c355
Merge pull request #358 from HASEL-UZH/350-win-code-sign
casaout Jan 24, 2025
7f74250
[#350] testing auto-update for code-signed win version
casaout Jan 24, 2025
51a5247
Merge pull request #359 from HASEL-UZH/350-win-code-sign
casaout Jan 24, 2025
0bbf7d4
[#350] updated electron-updater
casaout Jan 24, 2025
211be7c
Merge pull request #360 from HASEL-UZH/350-win-code-sign
casaout Jan 24, 2025
01e86b7
[#350] testing auto-update on windows
casaout Jan 24, 2025
8af1852
Merge pull request #361 from HASEL-UZH/350-win-code-sign
casaout Jan 24, 2025
d62c3c2
[#350] added explicit publisherName for Windows, updated signing docu
casaout Jan 24, 2025
e714b53
[#350] version bump to trigger build
casaout Jan 24, 2025
c80b73e
Merge pull request #362 from HASEL-UZH/350-win-code-sign
casaout Jan 24, 2025
f394815
[#350] trying updater without verification
casaout Jan 24, 2025
4f168b0
Merge pull request #363 from HASEL-UZH/350-win-code-sign
casaout Jan 24, 2025
b454bee
[#350] another try
casaout Jan 24, 2025
a05b1ab
Merge pull request #364 from HASEL-UZH/350-win-code-sign
casaout Jan 24, 2025
28bb666
[#350] attempting to fix macOS updater
casaout Jan 28, 2025
25c46ae
Merge pull request #367 from HASEL-UZH/350-win-code-sign
casaout Jan 28, 2025
a8936e9
[#350] trigger update to 0.0.32
casaout Jan 28, 2025
bd4b731
Merge pull request #368 from HASEL-UZH/350-win-code-sign
casaout Jan 28, 2025
868ba82
[#350] trying to fix macos build
casaout Jan 28, 2025
d57079e
Merge pull request #369 from HASEL-UZH/350-win-code-sign
casaout Jan 28, 2025
dfb713c
[#350] trying to fix macOS build
casaout Jan 28, 2025
ab7f6b4
Merge pull request #370 from HASEL-UZH/350-win-code-sign
casaout Jan 28, 2025
0697ddb
[#350] trying to fix update code signature verification on windows
casaout Feb 4, 2025
ba0acec
Merge pull request #371 from HASEL-UZH/350-win-code-sign
casaout Feb 4, 2025
38fb025
[#350] trying to fix update code signature verification on windows (v…
casaout Feb 4, 2025
d043f9b
Merge pull request #372 from HASEL-UZH/350-win-code-sign
casaout Feb 4, 2025
0f17460
[#350] trying to fix update code signature verification on windows
casaout Feb 4, 2025
725f8ee
Merge branch 'main' of https://github.com/HASEL-UZH/PersonalAnalytics
casaout Feb 4, 2025
5b891df
[#350] removing publisherName tag again (no longer supported)
casaout Feb 4, 2025
a19b804
[#373] disabled verify update code signature on windows
casaout Feb 4, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build
name: Build and Publish PersonalAnalytics
on:
push:
branches:
Expand Down Expand Up @@ -49,5 +49,12 @@ jobs:
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
AZURE_PUBLISHER_NAME: ${{ vars.AZURE_PUBLISHER_NAME }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
AZURE_ENDPOINT: ${{ secrets.AZURE_ENDPOINT }}
AZURE_CODE_SIGNING_NAME: ${{ secrets.AZURE_CODE_SIGNING_NAME }}
AZURE_CERT_PROFILE_NAME: ${{ secrets.AZURE_CERT_PROFILE_NAME }}
CSC_LINK: ${{ secrets.CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
48 changes: 45 additions & 3 deletions documentation/RESEARCH.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ To use GitHub Actions to build and create PersonalAnalytics releases, you need t
- `CSC_LINK` (link to Apple Developer Certificate in \*.p12 format)
- `CSC_KEY_PASSWORD` (password for the Apple Developer Certificate)

### Required Changes in `electron-builder.json5`
### Required Changes in `electron-builder.config.cjs`
These changes are required to automatically publish the built artifacts to GitHub releases. You need to replace the `owner` and `repo` with your GitHub username and repository name.
You can find more information on electron-builder here: https://www.electron.build/ and for the `electron-builder.json5` file here: https://www.electron.build/configuration/configuration
You can find more information on electron-builder here: https://www.electron.build/ and for the `electron-builder.config.cjs` file here: https://www.electron.build/configuration/configuration

```json5
```cjfs
{
publish: {
provider: "github",
Expand Down Expand Up @@ -146,6 +146,48 @@ Note that we're using Electron Builder and Github Actions (see [docu]([url](http
- Manually download and test the release, and if all is good, publish it!
- Releases are found under https://github.com/HASEL-UZH/PersonalAnalytics/releases

#### Code Signing for Windows

For Windows, we are using Azure Trusted Signing (beta) for code signing using Andre's personal account.
Please refer to the [electron-builder documentation](https://www.electron.build/code-signing.html#using-with-azure-trusted-signing-beta)
and [Azure's documentation](https://learn.microsoft.com/en-us/azure/trusted-signing/how-to-signing-integrations)
for more information. Following [this guide](https://melatonin.dev/blog/code-signing-on-windows-with-azure-trusted-signing/), the following
secrets and variables were defined for the GitHub action:

#### Secrets & Variables

| Name | Description |
|---------------------------|------------------------------------------------------------------------------------------------------------------------------------------|
| `AZURE_TENANT_ID` | The Microsoft Entra tenant (directory) ID. |
| `AZURE_CERT_PROFILE_NAME` | The name of the certificate (public trust) profile. |
| `AZURE_CLIENT_ID` | The client (application) ID of an App Registration in the tenant. |
| `AZURE_CLIENT_SECRET` | The client secret that was generated for the App Registration. |
| `AZURE_CODE_SIGNING_NAME` | The name of the trusted signing account (from the main Trusted Signing Account page in Azure). |
| `AZURE_ENDPOINT` | The URL for the selected region, labelled as Account URI (from the main Trusted Signing Account page in Azure). |
| `AZURE_PUBLISHER_NAME` | The publisher name used for code signing for Windows builds. This is the full string in the form of `CN=..., O=..., L=..., S=..., C=CH`. |

Note that using special characters (e.g. `é`) in the publisher name can lead to issues with the code signing process.

The above secrets and variables are used in the action files (e.g., [build.yml](https://github.com/HASEL-UZH/PersonalAnalytics/blob/dev/.github/workflows/build.yml)) and
provided to the electron-builder ([electron-builder.config.cjs](../src/electron/electron-builder.config.cjs)) via environment variables.

#### Code Signing for macOS

For macOS, the electron-builder's code signing is
disabled ([electron-builder.config.cjs](../src/electron/electron-builder.config.cjs)) and we are using the `afterSign` hook to
call the [notarize.cjs](../src/electron/scripts/notarize.cjs) script to sign the application using the `@electron/notarize`
package. The following environment variables are required for the code signing process:

### Secrets

| Name | Description |
|-------------------------------|-----------------------------------------------------------------------------------------------------|
| `APPLE_ID` | The Apple ID used for notarization. |
| `APPLE_ID_PASS` | The password for the Apple ID. |
| `APPLE_TEAM_ID` | The Apple Team ID (https://developer.apple.com/help/account/manage-your-team/locate-your-team-id/). |
| `APPLE_APP_SPECIFIC_PASSWORD` | App-Specific Password (https://appleid.apple.com/account/manage). |
| `CSC_LINK` | base64-encoded data of the Apple Developer Account certificate. |
| `CSC_KEY_PASSWORD` | Password of the Apple Developer Account certificate used to decrypt the certificate. |

### Testing PersonalAnalytics
PersonalAnalytics was tested on `Windows 11` and `macOS 14`. It might work on older versions as well.
Expand Down
23 changes: 17 additions & 6 deletions src/electron/electron-builder.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,19 @@ module.exports = {
owner: 'HASEL-UZH',
repo: 'PersonalAnalytics'
},
afterSign: "scripts/notarize.cjs",
mac: {
artifactName: '${productName}-${version}-${env.MAC_ARCH_TYPE}.${ext}',
target: {
target: "default",
arch: ["x64", "arm64"],
},
artifactName: '${productName}-${version}-${arch}.${ext}',
asarUnpack: ['node_modules/**/*.node'],
entitlements: 'build/entitlements.mac.plist',
entitlementsInherit: 'build/entitlements.mac.plist',
hardenedRuntime: true,
gatekeeperAssess: false,
notarize: {
teamId: `${process.env.APPLE_TEAM_ID}`
},
notarize: false,
extendInfo: [
{
key: 'NSAppleEventsUsageDescription',
Expand All @@ -41,11 +44,19 @@ module.exports = {
writeUpdateInfo: false
},
win: {
artifactName: '${productName}-${version}-Windows.${ext}'
target: ["nsis"],
verifyUpdateCodeSignature: false,
azureSignOptions: {
publisherName: `${process.env.AZURE_PUBLISHER_NAME}`,
endpoint: `${process.env.AZURE_ENDPOINT}`,
codeSigningAccountName: `${process.env.AZURE_CODE_SIGNING_NAME}`,
certificateProfileName: `${process.env.AZURE_CERT_PROFILE_NAME}`,
},
},
nsis: {
oneClick: true,
deleteAppDataOnUninstall: false,
differentialPackage: false
differentialPackage: false,
artifactName: '${productName}-${version}-Windows.${ext}',
}
};
Loading