Skip to content

Instantly share code, notes, and snippets.

@bacongravy
Created June 14, 2020 23:11
Show Gist options
  • Save bacongravy/29eef71ba121d8e97364d65a2e9ba895 to your computer and use it in GitHub Desktop.
Save bacongravy/29eef71ba121d8e97364d65a2e9ba895 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -euo pipefail
security create-keychain -p "" build.keychain
security list-keychains -s build.keychain
security default-keychain -s build.keychain
security unlock-keychain -p "" build.keychain
security set-keychain-settings
security import <(echo $SIGNING_CERTIFICATE_P12_DATA | base64 --decode) \
-f pkcs12 \
-k build.keychain \
-P $SIGNING_CERTIFICATE_PASSWORD \
-T /usr/bin/codesign
security set-key-partition-list -S apple-tool:,apple: -s -k "" build.keychain
@aljux
Copy link

aljux commented Aug 16, 2023

This has stopped working with the error

security: SecKeychainItemImport: One or more parameters passed to a function were not valid.
bad decrypt

Does anyone know if something has changed recently in github actions?

@thankiyash
Copy link

Check if you're passing the right environment to github action. That was the error for me

jobs:
  build_with_signing:
    runs-on: macos-latest

    ###This fixed it for me###
    environment: stage

    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment