Skip to content

SolidCraft: an open-source parametric 3D CAD application built in pure Rust. Desktop, web, and automation through MCP.

Release: sign Windows binaries and MSI through SignPath Foundation (#7067)

bherbruck9e4dc4816559
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 021fcd003e..72c4a55859 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -5,7 +5,9 @@
# the draft separately; see docs/releasing.md. Tags and pushes to main do not trigger releases.
# At midnight Eastern, changed main commits build and publish a nightly pre-release.
# A version with a suffix (0.2.0-rc.1) is a pre-release.
-# The macOS app is signed and notarized when the APPLE_* secrets exist, nothing else is signed yet.
+# The macOS app is signed and notarized when the APPLE_* secrets exist. The Windows binaries and
+# MSI are Authenticode-signed through SignPath Foundation when the SIGNPATH_API_TOKEN secret exists
+# (see the windows job). Nothing else is signed yet.
#
# Linux x86_64, aarch64 AppImage (+ .zsync), .deb, .rpm, .flatpak, .snap, .tar.gz packaging/linux
# FreeBSD x86_64 .tar.gz (built in a FreeBSD VM) packaging/freebsd
@@ -18,6 +20,8 @@
# releases/latest/download/<name> links in the README keep working across releases.
#
# A dry run: dispatch with draft=false (the default). Only the release branch may create drafts.
+# A dry run from any branch also test-signs the Windows files when SIGNPATH_API_TOKEN exists:
+# gh workflow run release.yml --ref <branch> -f draft=false [-f signpath_signing_policy=test-signing]
name: Release
on:
@@ -32,6 +36,10 @@ on:
description: "Create/update a draft (release branch only; off: build artifacts only)"
type: boolean
default: false
+ signpath_signing_policy:
+ description: "SignPath signing policy for the Windows files (empty: the repository variable, else test-signing)"
+ type: string
+ default: ""
permissions:
contents: read
@@ -378,7 +386,14 @@ jobs:
name: Windows ${{ matrix.arch }}
needs: [version, icons]
if: needs.version.outputs.build == 'true'
+ # Must stay a GitHub-hosted runner, like every job before it: SignPath's open-source policy
+ # only signs builds whose jobs all ran on GitHub-hosted runners.
runs-on: windows-latest
+ # actions: read lets the SignPath action read this job's details and fetch the uploaded
+ # artifact with GITHUB_TOKEN (the workflow default above grants contents: read only).
+ permissions:
+ contents: read
+ actions: read
strategy:
fail-fast: false
matrix:
@@ -389,6 +404,16 @@ jobs:
- { arch: arm64, target: aarch64-pc-windows-msvc }
env:
SOLIDCRAFT_VERSION: ${{ needs.version.outputs.version }}
+ # Authenticode signing through SignPath Foundation (docs/releasing.md, "Windows signing").
+ # Only when the API token secret exists: forks and repositories without it build unsigned,
+ # exactly as before. `if:` can't read secrets, so the check goes through this variable.
+ SIGN_WINDOWS: ${{ secrets.SIGNPATH_API_TOKEN != '' }}
+ # The one switch between the self-signed test certificate (test-signing) and the real one
+ # (release-signing): a dispatch input, else the SIGNPATH_SIGNING_POLICY repository variable,
+ # else test-signing.
+ SIGNPATH_SIGNING_POLICY: ${{ inputs.signpath_signing_policy || vars.SIGNPATH_SIGNING_POLICY || 'test-signing' }}
+ SIGNPATH_ORGANIZATION_ID: fa603ff4-c702-404b-8588-a524371c7a4e
+ SIGNPATH_PROJECT_SLUG: solidcraft
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
@@ -407,10 +432,109 @@ jobs:
dotnet tool install --global wix --version 5.0.2
wix extension add -g WixToolset.UI.wixext/5.0.2 WixToolset.Util.wixext/5.0.2
- name: Build and package (msi, portable zip)
+ if: env.SIGN_WINDOWS != 'true'
shell: pwsh
env:
SOLIDCRAFT_ICONS: ${{ github.workspace }}/icons
run: ./packaging/windows/package.ps1 -Arch ${{ matrix.arch }}
+
+ # ---- signed path ---------------------------------------------------------------------------
+ # SignPath's GitHub integration (docs.signpath.io/trusted-build-systems/github): the files go
+ # up as a workflow artifact, SignPath fetches that artifact itself (so it can verify it came
+ # from this workflow run), signs it, and the action downloads the signed copy. GitHub stores
+ # artifacts as zips, so packaging/windows/signpath-artifact-configuration.xml (pasted into the
+ # SignPath project) describes a zip holding the files at its top level.
+ # Two rounds: the .exe files first, so the MSI, the portable zip and the plain .exe all carry
+ # signed binaries; then the MSI built from them.
+ - name: Build and stage the binaries for signing
+ if: env.SIGN_WINDOWS == 'true'
+ shell: pwsh
+ env:
+ SOLIDCRAFT_ICONS: ${{ github.workspace }}/icons
+ run: ./packaging/windows/package.ps1 -Arch ${{ matrix.arch }} -Phase stage
+ - name: Upload the unsigned binaries
+ id: unsigned-exes
+ if: env.SIGN_WINDOWS == 'true'
+ uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
+ with:
+ name: signpath-unsigned-exes-windows-${{ matrix.arch }}
+ path: target/windows-package/${{ matrix.arch }}/*.exe
+ if-no-files-found: error
+ retention-days: 3
+ - name: Sign the binaries (SignPath, ${{ env.SIGNPATH_SIGNING_POLICY }})
+ if: env.SIGN_WINDOWS == 'true'
+ uses: signpath/github-action-submit-signing-request@f6d04783b4569d051e0c80105fe66e82819d0092 # v3.0
+ with:
+ api-token: ${{ secrets.SIGNPATH_API_TOKEN }}
+ organization-id: ${{ env.SIGNPATH_ORGANIZATION_ID }}
+ project-slug: ${{ env.SIGNPATH_PROJECT_SLUG }}
+ signing-policy-slug: ${{ env.SIGNPATH_SIGNING_POLICY }}
+ github-artifact-id: ${{ steps.unsigned-exes.outputs.artifact-id }}
+ wait-for-completion: true
+ # release-signing requests wait for a person to approve them in SignPath; give that an
+ # hour instead of the default 10 minutes. test-signing requests finish in seconds.
+ wait-for-completion-timeout-in-seconds: 3600
+ output-artifact-directory: target/windows-package/signed-exes-${{ matrix.arch }}
+ - name: Put the signed binaries in place
+ if: env.SIGN_WINDOWS == 'true'
+ shell: pwsh
+ run: |
+ $ErrorActionPreference = 'Stop'
+ $stage = "target/windows-package/${{ matrix.arch }}"
+ foreach ($exe in 'solidcraft.exe', 'solidcraft-cli.exe', 'solvecraft-cli.exe') {
+ $signed = "target/windows-package/signed-exes-${{ matrix.arch }}/$exe"
+ # The artifact configuration matches each file optionally, so check that every file
+ # actually came back signed rather than trusting the request's success.
+ $sig = Get-AuthenticodeSignature $signed
+ if (-not $sig.SignerCertificate) { throw "$exe came back from SignPath without a signature ($($sig.Status))" }
+ # The test certificate is self-signed, so Status is not Valid until release-signing.
+ Write-Output "$exe signed by $($sig.SignerCertificate.Subject) (status: $($sig.Status))"
+ Copy-Item -Force $signed "$stage/$exe"
+ }
+ - name: Package the signed binaries (msi, portable zip)
+ if: env.SIGN_WINDOWS == 'true'
+ shell: pwsh
+ env:
+ SOLIDCRAFT_ICONS: ${{ github.workspace }}/icons
+ run: ./packaging/windows/package.ps1 -Arch ${{ matrix.arch }} -Phase package
+ - name: Upload the unsigned MSI
+ id: unsigned-msi
+ if: env.SIGN_WINDOWS == 'true'
+ uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
+ with:
+ name: signpath-unsigned-msi-windows-${{ matrix.arch }}
+ path: dist/release/*.msi
+ if-no-files-found: error
+ retention-days: 3
+ - name: Sign the MSI (SignPath, ${{ env.SIGNPATH_SIGNING_POLICY }})
+ if: env.SIGN_WINDOWS == 'true'
+ uses: signpath/github-action-submit-signing-request@f6d04783b4569d051e0c80105fe66e82819d0092 # v3.0
+ with:
+ api-token: ${{ secrets.SIGNPATH_API_TOKEN }}
+ organization-id: ${{ env.SIGNPATH_ORGANIZATION_ID }}
+ project-slug: ${{ env.SIGNPATH_PROJECT_SLUG }}
+ signing-policy-slug: ${{ env.SIGNPATH_SIGNING_POLICY }}
+ github-artifact-id: ${{ steps.unsigned-msi.outputs.artifact-id }}
+ wait-for-completion: true
+ wait-for-completion-timeout-in-seconds: 3600
+ output-artifact-directory: target/windows-package/signed-msi-${{ matrix.arch }}
+ - name: Put the signed MSI in place
+ if: env.SIGN_WINDOWS == 'true'
+ shell: pwsh
+ run: |
+ $ErrorActionPreference = 'Stop'
+ $msi = Get-Item "dist/release/*.msi"
+ $signed = "target/windows-package/signed-msi-${{ matrix.arch }}/$($msi.Name)"
+ $sig = Get-AuthenticodeSignature $signed
+ if (-not $sig.SignerCertificate) { throw "$($msi.Name) came back from SignPath without a signature ($($sig.Status))" }
+ Write-Output "$($msi.Name) signed by $($sig.SignerCertificate.Subject) (status: $($sig.Status))"
+ Copy-Item -Force $signed $msi.FullName
+ "Windows ${{ matrix.arch }}: Authenticode-signed through SignPath (policy $env:SIGNPATH_SIGNING_POLICY, $($sig.SignerCertificate.Subject))." >> $env:GITHUB_STEP_SUMMARY
+ - name: Note the unsigned build
+ if: env.SIGN_WINDOWS != 'true'
+ shell: pwsh
+ run: '"Windows ${{ matrix.arch }}: unsigned (no SIGNPATH_API_TOKEN secret)." >> $env:GITHUB_STEP_SUMMARY'
+
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: release-windows-${{ matrix.arch }}
diff --git a/docs/releasing.md b/docs/releasing.md
index 4df1da1c4d..9ad1ceeda6 100644
--- a/docs/releasing.md
+++ b/docs/releasing.md
@@ -154,8 +154,9 @@ change release infrastructure does not itself request publication of the applica
other platforms; report any platform you could not exercise yourself.
3. Review the generated notes. Add a concise description of features, fixes, breaking changes,
and known limitations. Keep the installation instructions. The macOS app is Developer ID
- signed and notarized only when the build summary says so; other packages are unsigned. Do not
- claim otherwise. Resolve failed checks or missing artifacts before publication.
+ signed and notarized only when the build summary says so, and the Windows files are signed only
+ when it says which SignPath policy signed them (`test-signing` is a self-signed test certificate
+ that Windows does not trust); other packages are unsigned. Do not claim otherwise. Resolve failed checks or missing artifacts before publication.
4. Publish the verified draft using `gh` or the equivalent GitHub release API. For example:
```sh
@@ -316,6 +317,29 @@ Signing currently uses a maintainer's **personal** Developer ID, so downloads sh
name, not an organisation's. Moving to an organisation account means replacing the certificate
and the API key secrets (`APPLE_API_KEY_P8`, `APPLE_API_KEY_ID`, `APPLE_API_ISSUER`).
+## Windows signing (SignPath Foundation)
+
+When the `SIGNPATH_API_TOKEN` secret (the API token of the SignPath CI user) exists, the release
+workflow's Windows jobs Authenticode-sign through [SignPath Foundation](https://signpath.org)
+(organization `fa603ff4-c702-404b-8588-a524371c7a4e`, project `solidcraft`). Each architecture
+sends two signing requests: `solidcraft.exe`, `solidcraft-cli.exe` and `solvecraft-cli.exe` first,
+so the MSI, the portable zip and the plain `.exe` are made from signed binaries, then the MSI. Each
+request uploads the files as a workflow artifact, SignPath fetches and signs it, and the job checks
+that every file came back signed. Without the secret (forks) the jobs build unsigned as before.
+
+- **Policy:** `test-signing` (a self-signed test certificate) unless the dispatch input
+ `signpath_signing_policy` or the repository variable `SIGNPATH_SIGNING_POLICY` says otherwise.
+ Switch to the real certificate with `gh variable set SIGNPATH_SIGNING_POLICY -b release-signing
+ -R tangency-labs/solidcraft` once SignPath has issued it. Requests under `release-signing` wait
+ for approval in SignPath; the workflow waits up to an hour for each.
+- **Artifact configuration:** `packaging/windows/signpath-artifact-configuration.xml`. When it
+ changes, paste the new version into the SignPath project's artifact configuration when it lands.
+- **Test-sign without publishing:** `gh workflow run release.yml -R tangency-labs/solidcraft --ref
+ <branch> -f draft=false`, then check the Windows jobs' summaries and the `release-assets`
+ artifact.
+- SignPath only signs runs whose jobs all ran on GitHub-hosted runners, so keep the `version`,
+ `icons` and `windows` jobs off self-hosted runners.
+
## Homebrew tap
macOS users install with `brew install --cask tangency-labs/tap/solidcraft` from the tap repository
diff --git a/packaging/windows/package.ps1 b/packaging/windows/package.ps1
index f2b99cb573..2d3844146d 100644
--- a/packaging/windows/package.ps1
+++ b/packaging/windows/package.ps1
@@ -11,7 +11,14 @@
The binaries link the C runtime statically (+crt-static), so nothing else needs installing.
The icon comes from $env:SOLIDCRAFT_ICONS (solidcraft.ico, made by `solidcraft-cli icon`), or
- is drawn by the CLI just built when this machine can run it. Nothing is signed.
+ is drawn by the CLI just built when this machine can run it.
+
+ Signing happens outside this script (the release workflow sends files to SignPath), so the work
+ can be split in two phases with signing in between:
+ -Phase stage build, check, and copy the three .exe files to the staging folder, then stop
+ -Phase package make the MSI, portable zip and plain .exe from the staging folder as it is
+ now (holding the signed .exe files), without building again
+ -Phase all (the default) does both, unsigned, as before.
Needs: Rust (MSVC toolchain + the target) and WiX v5:
dotnet tool install --global wix --version 5.0.2
@@ -22,10 +29,13 @@
.EXAMPLE
pwsh packaging/windows/package.ps1 -Arch x64
pwsh packaging/windows/package.ps1 -Arch arm64 # cross-compiled; needs the MSVC ARM64 build tools
+ pwsh packaging/windows/package.ps1 -Arch x64 -Phase stage # then sign target/windows-package/x64/*.exe
+ pwsh packaging/windows/package.ps1 -Arch x64 -Phase package
#>
param(
[ValidateSet('x64', 'x86', 'arm64')] [string] $Arch = 'x64',
- [switch] $SkipBuild
+ [switch] $SkipBuild,
+ [ValidateSet('all', 'stage', 'package')] [string] $Phase = 'all'
)
$ErrorActionPreference = 'Stop'
$Root = (Resolve-Path (Join-Path $PSScriptRoot '..\..')).Path
@@ -56,7 +66,7 @@ New-Item -ItemType Directory -Force -Path $Dist | Out-Null
Write-Output "SolidCraft $Version for Windows $Arch ($Target)"
-if (-not $SkipBuild) {
+if (-not $SkipBuild -and $Phase -ne 'package') {
# Static CRT: no VC++ redistributable needed. Scoped to the target so host build scripts and
# proc-macros are unaffected.
$flagVar = 'CARGO_TARGET_' + ($Target.ToUpper() -replace '-', '_') + '_RUSTFLAGS'
@@ -64,6 +74,9 @@ if (-not $SkipBuild) {
Invoke-Native "cargo build ($Target)" { cargo build --release --locked -p solidcraft -p solidcraft-cli --target $Target }
}
$Bin = Join-Path $TargetDir "$Target\release"
+$Stage = Join-Path $TargetDir "windows-package\$Arch"
+# -Phase package checks the staged (by then signed) copies; the other phases check the build.
+$CheckDir = if ($Phase -eq 'package') { $Stage } else { $Bin }
# Check both binaries' PE headers: Machine must match -Arch; Subsystem 2 = GUI (the app opens no
# console window), 3 = console (the CLI's output reaches the terminal).
@@ -76,17 +89,22 @@ $Machine = switch ($Arch) { 'x64' { 0x8664 } 'x86' { 0x14C } 'arm64' { 0xAA64 }
# solvecraft-cli.exe: the old CLI name, forwarding to solidcraft-cli.exe (compatibility shim,
# docs/compatibility.md). Built by `-p solidcraft-cli` with the CLI.
foreach ($check in @(@('solidcraft.exe', 2), @('solidcraft-cli.exe', 3), @('solvecraft-cli.exe', 3))) {
- $h = Get-PeHeader (Join-Path $Bin $check[0])
+ $h = Get-PeHeader (Join-Path $CheckDir $check[0])
if ($h.Machine -ne $Machine) { throw "$($check[0]) is for machine 0x$('{0:X}' -f $h.Machine), expected 0x$('{0:X}' -f $Machine) ($Arch)" }
if ($h.Subsystem -ne $check[1]) { throw "$($check[0]) has PE subsystem $($h.Subsystem), expected $($check[1])" }
Write-Output "ok $($check[0]): $Arch, PE subsystem $($h.Subsystem)"
}
-$Stage = Join-Path $TargetDir "windows-package\$Arch"
-& (Join-Path $PSScriptRoot 'check-icon.ps1') -Path (Join-Path $Bin 'solidcraft.exe')
-Remove-Item -Recurse -Force $Stage -ErrorAction SilentlyContinue
-New-Item -ItemType Directory -Force -Path $Stage | Out-Null
-Copy-Item (Join-Path $Bin 'solidcraft.exe'), (Join-Path $Bin 'solidcraft-cli.exe'), (Join-Path $Bin 'solvecraft-cli.exe') $Stage
-foreach ($f in 'LICENSE-MIT', 'LICENSE-APACHE', 'NOTICE', 'THIRD-PARTY-LICENSES.txt') { Copy-Item (Join-Path $Root $f) $Stage }
+& (Join-Path $PSScriptRoot 'check-icon.ps1') -Path (Join-Path $CheckDir 'solidcraft.exe')
+if ($Phase -ne 'package') {
+ Remove-Item -Recurse -Force $Stage -ErrorAction SilentlyContinue
+ New-Item -ItemType Directory -Force -Path $Stage | Out-Null
+ Copy-Item (Join-Path $Bin 'solidcraft.exe'), (Join-Path $Bin 'solidcraft-cli.exe'), (Join-Path $Bin 'solvecraft-cli.exe') $Stage
+ foreach ($f in 'LICENSE-MIT', 'LICENSE-APACHE', 'NOTICE', 'THIRD-PARTY-LICENSES.txt') { Copy-Item (Join-Path $Root $f) $Stage }
+}
+if ($Phase -eq 'stage') {
+ Write-Output "staged for signing: $Stage"
+ exit 0
+}
$Icon = if ($env:SOLIDCRAFT_ICONS) { Join-Path $env:SOLIDCRAFT_ICONS 'solidcraft.ico' } else { Join-Path $Root 'assets/icons/app/windows/exports/solidcraft.ico' }
if (-not (Test-Path $Icon)) { throw "Missing package icon: $Icon" }
diff --git a/packaging/windows/signpath-artifact-configuration.xml b/packaging/windows/signpath-artifact-configuration.xml
new file mode 100644
index 0000000000..1e114d8548
--- /dev/null
+++ b/packaging/windows/signpath-artifact-configuration.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ SignPath artifact configuration for the Windows release (project `solidcraft`).
+
+ This file is the source of truth: paste it into SignPath (Projects > solidcraft > Artifact
+ Configurations > the default configuration > Edit) whenever it changes, so the two stay in sync.
+
+ .github/workflows/release.yml submits two signing requests per architecture. GitHub stores every
+ workflow artifact as a zip, so the root element is a zip-file and the files sit at its top level:
+
+ 1. the binaries, before they are packed: solidcraft.exe, solidcraft-cli.exe, solvecraft-cli.exe
+ 2. the installer built from those signed binaries: solidcraft-<version>-windows-<arch>.msi
+
+ Each set is optional (min-matches="0") because each request carries only one of the two shapes.
+ The workflow checks afterwards that every file it sent came back with an Authenticode signature,
+ so a request that matched nothing fails the build instead of shipping unsigned files.
+-->
+<artifact-configuration xmlns="http://signpath.io/artifact-configuration/v1">
+ <zip-file>
+ <pe-file-set>
+ <include path="solidcraft.exe" min-matches="0" />
+ <include path="solidcraft-cli.exe" min-matches="0" />
+ <include path="solvecraft-cli.exe" min-matches="0" />
+ <for-each>
+ <authenticode-sign />
+ </for-each>
+ </pe-file-set>
+ <msi-file-set>
+ <include path="solidcraft-*-windows-*.msi" min-matches="0" />
+ <for-each>
+ <authenticode-sign />
+ </for-each>
+ </msi-file-set>
+ </zip-file>
+</artifact-configuration>