Skip to content

Commit 7ca2f5d

Browse files
committed
Keep empty signing secrets out of release builds
The v0.3.2 release proved that exporting blank CSC_LINK makes electron-builder treat the macOS project directory as a certificate path. The workflow now only exports CSC_LINK when the certificate secret is present and otherwise unsets signing variables before packaging. Constraint: GitHub Actions exposes absent secrets as empty environment values when mapped directly Rejected: Re-run v0.3.2 unchanged | release workflow fails before artifacts are uploaded Confidence: high Scope-risk: narrow Directive: Do not expose blank CSC_LINK/CSC_KEY_PASSWORD to electron-builder; unset them when unsigned builds are intentional Tested: node --test apps/macos/electron/*.test.cjs; npm run typecheck; ruby YAML parse for release.yml; git diff --check; unset CSC_LINK CSC_KEY_PASSWORD with CSC_IDENTITY_AUTO_DISCOVERY=false npm --workspace @paste/macos run dist -- --mac zip --arm64 Not-tested: Production Developer ID certificate signing path in GitHub Actions
1 parent 2adf2d9 commit 7ca2f5d

4 files changed

Lines changed: 23 additions & 10 deletions

File tree

.github/workflows/release.yml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ jobs:
1616
matrix:
1717
arch: [x64, arm64]
1818
env:
19-
CSC_LINK: ${{ secrets.MACOS_CERTIFICATE }}
20-
CSC_KEY_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }}
21-
CSC_IDENTITY_AUTO_DISCOVERY: ${{ secrets.MACOS_CERTIFICATE == '' && 'false' || 'true' }}
19+
MACOS_CERTIFICATE_CONFIGURED: ${{ secrets.MACOS_CERTIFICATE == '' && 'false' || 'true' }}
2220
APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }}
2321
APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
2422
steps:
@@ -55,12 +53,27 @@ jobs:
5553
printf '%s' "${APPLE_API_KEY_CONTENT}" > "${key_path}"
5654
chmod 600 "${key_path}"
5755
echo "APPLE_API_KEY=${key_path}" >> "${GITHUB_ENV}"
58-
- run: npm --workspace @paste/macos run dist -- --mac dmg zip --${{ matrix.arch }}
56+
- name: Build macOS artifacts
57+
shell: bash
58+
env:
59+
MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
60+
MACOS_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }}
61+
run: |
62+
set -euo pipefail
63+
if [[ -n "${MACOS_CERTIFICATE:-}" ]]; then
64+
export CSC_LINK="${MACOS_CERTIFICATE}"
65+
export CSC_KEY_PASSWORD="${MACOS_CERTIFICATE_PASSWORD:-}"
66+
export CSC_IDENTITY_AUTO_DISCOVERY=true
67+
else
68+
unset CSC_LINK CSC_KEY_PASSWORD
69+
export CSC_IDENTITY_AUTO_DISCOVERY=false
70+
fi
71+
npm --workspace @paste/macos run dist -- --mac dmg zip --${{ matrix.arch }}
5972
- name: Verify Developer ID signature when certificate is configured
6073
shell: bash
6174
run: |
6275
set -euo pipefail
63-
if [[ -z "${CSC_LINK:-}" ]]; then
76+
if [[ "${MACOS_CERTIFICATE_CONFIGURED}" != "true" ]]; then
6477
echo "MACOS_CERTIFICATE is not configured; macOS auto-update will stay disabled for this release."
6578
exit 0
6679
fi

apps/macos/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@paste/macos",
33
"private": true,
4-
"version": "0.3.2",
4+
"version": "0.3.3",
55
"type": "module",
66
"main": "electron/main.cjs",
77
"scripts": {

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "pastyx",
33
"private": true,
4-
"version": "0.3.2",
4+
"version": "0.3.3",
55
"workspaces": [
66
"apps/*",
77
"packages/*"

0 commit comments

Comments
 (0)