|
| 1 | +name: 'Setup iOS Codesigning' |
| 2 | +description: 'Import an Apple Development/Distribution signing certificate and download a provisioning profile via the App Store Connect API. Call once per bundle id; the cert import is automatically skipped on repeat calls within the same job.' |
| 3 | + |
| 4 | +inputs: |
| 5 | + p12-base64: |
| 6 | + description: 'Base64-encoded .p12 signing certificate' |
| 7 | + required: true |
| 8 | + p12-password: |
| 9 | + description: 'Password used when exporting the .p12' |
| 10 | + required: true |
| 11 | + asc-key-id: |
| 12 | + description: 'App Store Connect API Key ID' |
| 13 | + required: true |
| 14 | + asc-issuer-id: |
| 15 | + description: 'App Store Connect API Issuer ID' |
| 16 | + required: true |
| 17 | + asc-private-key-base64: |
| 18 | + description: 'Base64-encoded App Store Connect API private key (.p8)' |
| 19 | + required: true |
| 20 | + bundle-id: |
| 21 | + description: 'Bundle identifier of the target whose provisioning profile should be downloaded' |
| 22 | + required: true |
| 23 | + profile-type: |
| 24 | + description: 'Provisioning profile type to download (IOS_APP_DEVELOPMENT, IOS_APP_ADHOC, IOS_APP_STORE)' |
| 25 | + required: false |
| 26 | + default: 'IOS_APP_DEVELOPMENT' |
| 27 | + |
| 28 | +runs: |
| 29 | + using: composite |
| 30 | + steps: |
| 31 | + - name: Check for existing signing keychain |
| 32 | + id: keychain-check |
| 33 | + shell: bash |
| 34 | + run: | |
| 35 | + if security list-keychains -d user | grep -qi signing_temp; then |
| 36 | + echo "exists=true" >> "$GITHUB_OUTPUT" |
| 37 | + else |
| 38 | + echo "exists=false" >> "$GITHUB_OUTPUT" |
| 39 | + fi |
| 40 | +
|
| 41 | + - name: Import signing certificate |
| 42 | + if: steps.keychain-check.outputs.exists != 'true' |
| 43 | + uses: apple-actions/import-codesign-certs@v3 |
| 44 | + with: |
| 45 | + p12-file-base64: ${{ inputs.p12-base64 }} |
| 46 | + p12-password: ${{ inputs.p12-password }} |
| 47 | + keychain-password: ci-keychain |
| 48 | + |
| 49 | + - name: Download provisioning profile |
| 50 | + uses: apple-actions/download-provisioning-profiles@v3 |
| 51 | + with: |
| 52 | + bundle-id: ${{ inputs.bundle-id }} |
| 53 | + profile-type: ${{ inputs.profile-type }} |
| 54 | + issuer-id: ${{ inputs.asc-issuer-id }} |
| 55 | + api-key-id: ${{ inputs.asc-key-id }} |
| 56 | + api-private-key: ${{ inputs.asc-private-key-base64 }} |
0 commit comments