GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(ci): import passwordless macOS signing certificate (#59768) · ogrman/opencode@891a020

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • .github/workflows
    • release-dry-run.yml
    • release.yml
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎.github/workflows/release-dry-run.yml‎

Copy file name to clipboardExpand all lines: .github/workflows/release-dry-run.yml
+20-6Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -380,14 +380,23 @@ jobs:
380380
uses: ./.github/release/download
381381
with:
382382
pattern: "{build-npm,build-desktop-darwin-*}"
383+
# The certificate has no password, which apple-actions/import-codesign-certs rejects. The sign scripts look up
384+
# the identity in build.keychain, and codesign finds the key through the user search list.
383385
- name: Import certificate
384386
if: needs.plan.outputs.dry_run != 'true'
385-
uses: apple-actions/import-codesign-certs@8f3fb608891dd2244cdab3d69cd68c0d37a7fe93 # v2.0.0
386-
with:
387-
keychain: build
388-
p12-file-base64: ${{ secrets.APPLE_SIGNING_CERTIFICATE }}
389-
# The certificate has no password; the action passes this to `security import -P`.
390-
p12-password: ""
387+
run: |
388+
cert="$RUNNER_TEMP/cert.p12"
389+
keychain_password=$(openssl rand -base64 32)
390+
printf '%s' "$APPLE_SIGNING_CERTIFICATE" | base64 --decode > "$cert"
391+
security create-keychain -p "$keychain_password" build.keychain
392+
security set-keychain-settings -lut 21600 build.keychain
393+
security unlock-keychain -p "$keychain_password" build.keychain
394+
security import "$cert" -k build.keychain -P "" -T /usr/bin/codesign -T /usr/bin/security -T /usr/bin/productsign
395+
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$keychain_password" build.keychain > /dev/null
396+
security list-keychains -d user -s build.keychain $(security list-keychains -d user | tr -d '"')
397+
rm -f "$cert"
398+
env:
399+
APPLE_SIGNING_CERTIFICATE: ${{ secrets.APPLE_SIGNING_CERTIFICATE }}
391400
- name: Sign CLI
392401
if: needs.plan.outputs.cli == 'true'
393402
run: bash .github/release/sign-cli-macos.sh "$RUNNER_TEMP/in/build-npm" "$RUNNER_TEMP/out"
@@ -406,6 +415,11 @@ jobs:
406415
with:
407416
name: sign-macos
408417
path: ${{ runner.temp }}/out
418+
- name: Delete keychain
419+
if: always() && needs.plan.outputs.dry_run != 'true'
420+
run: |
421+
rm -f "$RUNNER_TEMP/cert.p12"
422+
security delete-keychain build.keychain || true
409423
410424
# Signs the Windows CLI and every executable and native module of the unpacked desktop apps.
411425
sign-windows:
Collapse file

‎.github/workflows/release.yml‎

Copy file name to clipboardExpand all lines: .github/workflows/release.yml
+20-6Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -399,14 +399,23 @@ jobs:
399399
uses: ./.github/release/download
400400
with:
401401
pattern: "{build-npm,build-desktop-darwin-*}"
402+
# The certificate has no password, which apple-actions/import-codesign-certs rejects. The sign scripts look up
403+
# the identity in build.keychain, and codesign finds the key through the user search list.
402404
- name: Import certificate
403405
if: needs.plan.outputs.dry_run != 'true'
404-
uses: apple-actions/import-codesign-certs@8f3fb608891dd2244cdab3d69cd68c0d37a7fe93 # v2.0.0
405-
with:
406-
keychain: build
407-
p12-file-base64: ${{ secrets.APPLE_SIGNING_CERTIFICATE }}
408-
# The certificate has no password; the action passes this to `security import -P`.
409-
p12-password: ""
406+
run: |
407+
cert="$RUNNER_TEMP/cert.p12"
408+
keychain_password=$(openssl rand -base64 32)
409+
printf '%s' "$APPLE_SIGNING_CERTIFICATE" | base64 --decode > "$cert"
410+
security create-keychain -p "$keychain_password" build.keychain
411+
security set-keychain-settings -lut 21600 build.keychain
412+
security unlock-keychain -p "$keychain_password" build.keychain
413+
security import "$cert" -k build.keychain -P "" -T /usr/bin/codesign -T /usr/bin/security -T /usr/bin/productsign
414+
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$keychain_password" build.keychain > /dev/null
415+
security list-keychains -d user -s build.keychain $(security list-keychains -d user | tr -d '"')
416+
rm -f "$cert"
417+
env:
418+
APPLE_SIGNING_CERTIFICATE: ${{ secrets.APPLE_SIGNING_CERTIFICATE }}
410419
- name: Sign CLI
411420
if: needs.plan.outputs.cli == 'true'
412421
run: bash .github/release/sign-cli-macos.sh "$RUNNER_TEMP/in/build-npm" "$RUNNER_TEMP/out"
@@ -425,6 +434,11 @@ jobs:
425434
with:
426435
name: sign-macos
427436
path: ${{ runner.temp }}/out
437+
- name: Delete keychain
438+
if: always() && needs.plan.outputs.dry_run != 'true'
439+
run: |
440+
rm -f "$RUNNER_TEMP/cert.p12"
441+
security delete-keychain build.keychain || true
428442
429443
# Signs the Windows CLI and every executable and native module of the unpacked desktop apps.
430444
sign-windows:

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.