Skip to content

Commit 75da1f2

Browse files
committed
Make macOS signing/DMG steps conditional on APPLE_CERT_P12 secret
Gate all signing, notarization, and DMG creation steps behind secrets.APPLE_CERT_P12 so forks without Apple signing credentials can still run the release workflow successfully.
1 parent c968b51 commit 75da1f2

1 file changed

Lines changed: 19 additions & 24 deletions

File tree

.github/workflows/release.yml

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,8 @@ jobs:
376376
name: Build MacOS Release
377377
runs-on: macos-latest
378378
timeout-minutes: 30
379+
env:
380+
CAN_SIGN: ${{ env.CAN_SIGN == 'true' }}
379381

380382
steps:
381383
- name: Checkout code
@@ -423,58 +425,54 @@ jobs:
423425
strip bin/moac
424426
strip -x bin/libastonia_net.dylib
425427
426-
# Build unsigned .app bundle
428+
# ---- macOS signing + DMG (skipped when Apple secrets are not configured) ----
427429
- name: Build .app bundle
430+
if: env.CAN_SIGN == 'true'
428431
run: make macos-appbundle
429432

430-
# Materialize the signing certificate from a base64-encoded secret
431433
- name: Install signing certificate
434+
if: env.CAN_SIGN == 'true'
432435
run: |
433436
mkdir -p certs
434437
echo "${{ secrets.APPLE_CERT_P12 }}" | base64 --decode > certs/dist.p12
435438
436-
# Materialize the App Store Connect API key file in ./private_keys
437-
# File name must match the api_key (KEY_ID) used later.
438439
- name: Install App Store Connect API key
440+
if: env.CAN_SIGN == 'true'
439441
run: |
440442
mkdir -p private_keys
441443
echo '${{ secrets.APP_STORE_CONNECT_KEY }}' > "private_keys/AuthKey_${{ secrets.APP_STORE_CONNECT_KEY_ID }}.p8"
442444
443445
- name: Install App Store Connect API key JSON
446+
if: env.CAN_SIGN == 'true'
444447
run: |
445448
echo '${{ secrets.APP_STORE_CONNECT_KEY_JSON }}' > private_keys/appstore_key.json
446449
447-
- name: Rename app with to tmp name
448-
run: |
449-
mv distrib/Astonia.app distrib/Astonia-unsigned.app
450+
- name: Rename app to tmp name
451+
if: env.CAN_SIGN == 'true'
452+
run: mv distrib/Astonia.app distrib/Astonia-unsigned.app
450453

451-
# 1) Sign app bundle
452454
- name: Sign Astonia.app
455+
if: env.CAN_SIGN == 'true'
453456
uses: indygreg/apple-code-sign-action@v1
454457
with:
455458
input_path: distrib/Astonia-unsigned.app
456459
output_path: distrib/Astonia.app
457-
458-
# Code signing certificate
459460
p12_file: certs/dist.p12
460461
p12_password: ${{ secrets.APPLE_CERT_P12_PASSWORD }}
461-
462462
notarize: false
463463
staple: false
464-
465464
rcodesign_version: 0.29.0
466-
467-
# Extra arguments passed directly to `rcodesign sign`
468465
sign_args: |
469466
--binary-identifier
470467
com.prismaphonic.astonia
471468
--for-notarization
472469
473470
- name: Remove unsigned app bundle
471+
if: env.CAN_SIGN == 'true'
474472
run: rm -rf distrib/Astonia-unsigned.app
475473

476-
# 2) Create an unsigned DMG wrapping the notarized .app
477-
- name: Create unsigned DMG from notarized app
474+
- name: Create unsigned DMG from signed app
475+
if: env.CAN_SIGN == 'true'
478476
run: |
479477
cd distrib
480478
hdiutil create \
@@ -486,33 +484,29 @@ jobs:
486484
cd ..
487485
ls -lh distrib/Astonia-macOS-unsigned.dmg
488486
489-
# 3) Sign + notarize + staple the DMG
490487
- name: Sign, notarize, and staple DMG
488+
if: env.CAN_SIGN == 'true'
491489
uses: indygreg/apple-code-sign-action@v1
492490
with:
493491
input_path: distrib/Astonia-macOS-unsigned.dmg
494492
output_path: distrib/Astonia-macOS.dmg
495-
496-
# Code signing certificate
497493
p12_file: certs/dist.p12
498494
p12_password: ${{ secrets.APPLE_CERT_P12_PASSWORD }}
499-
500495
rcodesign_version: 0.29.0
501-
502496
sign_args: |
503497
--for-notarization
504-
505-
# Notarization
506498
notarize: true
507499
staple: true
508500
app_store_connect_api_key_json_file: private_keys/appstore_key.json
509501
app_store_connect_api_issuer: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }}
510502
app_store_connect_api_key: ${{ secrets.APP_STORE_CONNECT_KEY_ID }}
511503

512504
- name: Remove unsigned DMG
505+
if: env.CAN_SIGN == 'true'
513506
run: rm -f distrib/Astonia-macOS-unsigned.dmg
514507

515508
- name: Upload signed DMG
509+
if: env.CAN_SIGN == 'true'
516510
uses: actions/upload-artifact@v4
517511
with:
518512
name: macos-dmg
@@ -569,6 +563,7 @@ jobs:
569563

570564
- name: Download macOS DMG
571565
uses: actions/download-artifact@v4
566+
continue-on-error: true
572567
with:
573568
name: macos-dmg
574569
path: .
@@ -595,7 +590,7 @@ jobs:
595590
sha256sum linux_client.tar.gz > checksums.txt
596591
sha256sum windows_client.zip >> checksums.txt
597592
sha256sum astonia-client.AppImage >> checksums.txt
598-
sha256sum Astonia-macOS.dmg >> checksums.txt
593+
[ -f Astonia-macOS.dmg ] && sha256sum Astonia-macOS.dmg >> checksums.txt || true
599594
sha256sum mod-sdk.zip >> checksums.txt
600595
601596
- name: Create Release

0 commit comments

Comments
 (0)