• TypeScript 97.5%
  • JavaScript 2.5%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-11-15 07:43:10 -07:00
.github Bump zizmorcore/zizmor-action from 0.8.0 to 0.8.1 2026-11-15 14:42:23 +00:00
dist [standardize-dist] Standardize dist generation on the shared esbuild setup. 2026-10-29 12:16:47 -06:00
src [identities-output] Add an identities output listing each valid code-signing identity by hash and name, so callers can sign by hash when a renewed certificate shares its name with the old one. Document the three macOS identities and how to combine them into one .p12. 2026-10-08 17:42:34 -06:00
tests [add-security-unit-tests] Fix prettier formatting in security unit tests. 2026-10-23 12:47:08 -06:00
.gitignore [main] Switch from ncc to esbuild and upgrade dependencies 2026-04-20 16:02:17 -06:00
.prettierignore [main] Switch from ncc to esbuild and upgrade dependencies 2026-04-20 16:02:17 -06:00
.prettierrc.json Initial commit 2020-01-20 16:01:17 +11:00
.yarnrc.yml [standardize-dist] Standardize dist generation on the shared esbuild setup. 2026-10-29 12:16:47 -06:00
action.yml [identities-output] Add an identities output listing each valid code-signing identity by hash and name, so callers can sign by hash when a renewed certificate shares its name with the old one. Document the three macOS identities and how to combine them into one .p12. 2026-10-08 17:42:34 -06:00
CONTRIBUTING.md [main] Add Release workflow and queue next minor version 2026-10-23 11:25:14 -06:00
eslint.config.mjs [main] Switch from ncc to esbuild and upgrade dependencies 2026-04-20 16:02:17 -06:00
LICENSE Upgrade typescript to v4.9 2023-09-20 13:48:16 +02:00
package.json Merge pull request #232 from Apple-Actions/dependabot/npm_and_yarn/vite-8.3.5 2026-11-01 07:43:59 -07:00
README.md [identities-output] Add an identities output listing each valid code-signing identity by hash and name, so callers can sign by hash when a renewed certificate shares its name with the old one. Document the three macOS identities and how to combine them into one .p12. 2026-10-08 17:42:34 -06:00
tsconfig.json [standardize-dist] Standardize dist generation on the shared esbuild setup. 2026-10-29 12:16:47 -06:00
vitest.config.ts [standardize-dist] Standardize dist generation on the shared esbuild setup. 2026-10-29 12:16:47 -06:00
yarn.lock [main] Regenerate yarn.lock 2026-11-01 13:09:58 -07:00

GitHub Action to import Apple Code-signing Certificates and Keys

License PRs welcome!

Getting Started

Use the same GitHub secrets as the rest of the Apple-Actions suite.

Canonical GitHub ENVs

Kind Name Purpose
Secret APPSTORE_CERTIFICATES_FILE_BASE64 Base64-encoded signing .p12
Secret APPSTORE_CERTIFICATES_PASSWORD Password for the .p12

Related ASC API vars/secrets (used by download-profiles / upload-testflight): APPSTORE_ISSUER_ID, APPSTORE_API_KEY_ID, APPSTORE_API_PRIVATE_KEY.

Create the signing certificate

Recommended: use the setup scripts in download-provisioning-profiles (scripts/setup.sh or scripts/create-signing-certificate.sh --p12-password ...). That creates the distribution certificate via the App Store Connect API and prints values for the secrets above.

Manual alternative:

  • Create a certificate signing request (see here)
  • Create an iOS Distribution (App Store Connect and Ad Hoc) certificate
  • Download ios_distribution.cer, import into Keychain Access → login → My Certificates, export as .p12
  • base64 -i ios_distribution.p12 | pbcopy → secret APPSTORE_CERTIFICATES_FILE_BASE64, plus APPSTORE_CERTIFICATES_PASSWORD

Usage

uses: apple-actions/import-codesign-certs@v7
with:
  p12-file-base64: ${{ secrets.APPSTORE_CERTIFICATES_FILE_BASE64 }}
  p12-password: ${{ secrets.APPSTORE_CERTIFICATES_PASSWORD }}

Multiple Certificates

If you need to add multiple certificates, select them all in the keychain when creating your p12 file. You do not need multiple separate steps.

macOS: App Store and Developer ID

A macOS app that ships to TestFlight / the Mac App Store and as a notarized Developer ID DMG needs three identities in one .p12:

Identity Signs
Apple Distribution The app, for the App Store
Mac Installer Distribution The .pkg uploaded to TestFlight
Developer ID Application The app and the DMG distributed outside the App Store

openssl pkcs12 holds only one private key, so build the combined .p12 with security. Import each identity's .p12 into a throwaway keychain, then export all of them together:

security create-keychain -p temp build.keychain
for p12 in distribution.p12 installer.p12 developer-id.p12; do
  security import "$p12" -k build.keychain -P "$P12_PASSWORD" -T /usr/bin/security
done
security export -k build.keychain -t identities -f pkcs12 -P "$P12_PASSWORD" -o all.p12
security delete-keychain build.keychain
base64 -i all.p12 | pbcopy # → APPSTORE_CERTIFICATES_FILE_BASE64

Profiles for both channels come from download-provisioning-profiles, and xcodebuild exports one archive for both. See Apple-Actions/Example-macOS for the full workflow, including upload-testflight-build and notarize.

Outputs

Name Description
keychain-password The password for the keychain.
security-response The output of the security commands.
identities JSON array of the valid code-signing identities in the keychain, each {"hash": "<SHA-1>", "name": "<common name>"}.

identities

A renewed certificate keeps the same name as the old one, so codesign --sign "<name>" fails as ambiguous while both are in the keychain. Sign by hash instead:

- id: certs
  uses: apple-actions/import-codesign-certs@v7
  with:
    p12-file-base64: ${{ secrets.APPSTORE_CERTIFICATES_FILE_BASE64 }}
    p12-password: ${{ secrets.APPSTORE_CERTIFICATES_PASSWORD }}

- name: Sign the DMG
  env:
    IDENTITIES: ${{ steps.certs.outputs.identities }}
  run: |
    hash=$(jq -r 'first(.[] | select(.name | startswith("Developer ID Application:")) | .hash)' <<<"$IDENTITIES")
    codesign --sign "$hash" --timestamp App.dmg

Additional Arguments

See action.yml for more details.

Contributing

We welcome your interest in contributing to this project. Please read the Contribution Guidelines for more guidance.

License

Any contributions made under this project will be governed by the MIT License.