From 45b674f3d1cf30cfb17423cede5a48338b961ecf Mon Sep 17 00:00:00 2001 From: david Date: Mon, 9 Dec 2024 14:24:55 +0100 Subject: [PATCH] split automatic and manual codesigning to different pages --- .../alternative-code-signing-methods-ios.md | 53 ++----------------- .../signing-ios-automatic.md | 52 ++++++++++++++++++ .../{signing-ios.md => signing-ios-manual.md} | 8 +-- 3 files changed, 59 insertions(+), 54 deletions(-) create mode 100644 content/yaml-code-signing/signing-ios-automatic.md rename content/yaml-code-signing/{signing-ios.md => signing-ios-manual.md} (96%) diff --git a/content/partials/alternative-code-signing-methods-ios.md b/content/partials/alternative-code-signing-methods-ios.md index dc48e695c..51fe12610 100644 --- a/content/partials/alternative-code-signing-methods-ios.md +++ b/content/partials/alternative-code-signing-methods-ios.md @@ -1,57 +1,10 @@ --- --- -### Automatic vs Manual code signing +## Alternative code signing +### Set up provisioning profiles and Certificates from environment variables -{{}} -Signing iOS applications requires [Apple Developer Program](https://developer.apple.com/programs/enroll/) membership. -{{}} - -Signing iOS apps requires a `signing certificate` (App Store **development** or **distribution** certificate in `.p12` format) and a `provisioning profile`. In **manual code signing** you save these files as Codemagic `environment variables` and manually reference them in the appropriate build steps. - -In **Automatic code signing**, Codemagic takes care of Certificate and Provisioning profile management for you. Based on the `Certificate private key` that you provide, Codemagic will automatically fetch the correct certificate from the App Store or create a new one if necessary. - -### Automatic code signing - -When automatic code signing is used, then most up-to-date signing files are obtained directly from Apple during the build time. This requires that Codemagic has access to your Apple Developer portal account, which is achieved by using App Store Connect API key. - -#### Creating the App Store Connect API key - -{{< include "/partials/app-store-connect-api-key.md" >}} - -{{< include "/partials/code-signing-ios-obtain-certificate.md" >}} - -{{< include "/partials/code-signing-ios-configure-environment-vars.md" >}} - -Finally, to code sign the app, add the following commands in the [`scripts`](../getting-started/yaml#scripts) section of the configuration file, after all the dependencies are installed, right before the build commands. - -{{< highlight yaml "style=paraiso-dark">}} - scripts: - - name: Set up keychain to be used for code signing using Codemagic CLI 'keychain' command - script: keychain initialize - - name: Fetch signing files - script: | - app-store-connect fetch-signing-files "$BUNDLE_ID" \ - --type IOS_APP_STORE \ - --create - - name: Set up signing certificate - script: keychain add-certificates - - name: Set up code signing settings on Xcode project - script: xcode-project use-profiles -{{< /highlight >}} - -Instead of specifying the exact bundle-id, you can use `"$(xcode-project detect-bundle-id)"`. - -Based on the specified bundle ID and [provisioning profile type](https://github.com/codemagic-ci-cd/cli-tools/blob/master/docs/app-store-connect/fetch-signing-files.md#--typeios_app_adhoc--ios_app_development--ios_app_inhouse--ios_app_store--mac_app_development--mac_app_direct--mac_app_store--mac_catalyst_app_development--mac_catalyst_app_direct--mac_catalyst_app_store--tvos_app_adhoc--tvos_app_development--tvos_app_inhouse--tvos_app_store) set with the `--type` argument, Codemagic will fetch or create the relevant provisioning profile and certificate to code sign the build. - -If you are publishing to the **App Store** or you are using **TestFlight** to distribute your app to test users, set the `--type` argument to `IOS_APP_STORE`. - -When using a **third party app distribution service** such as Firebase App Distribution, set the `--type` argument to `IOS_APP_ADHOC` - - -### Manual code signing - -In order to use manual code signing, you need the following: +In order to use this alternative code signing, you need the following: - **Signing certificate**: Your development or distribution certificate in .P12 format. - **Certificate password**: The certificate password if the certificate is password-protected. - **Provisioning profile**: You can get it from **Apple Developer Center > Certificates, Identifiers & Profiles > Profiles** and select the provisioning profile you would like to export and download. diff --git a/content/yaml-code-signing/signing-ios-automatic.md b/content/yaml-code-signing/signing-ios-automatic.md new file mode 100644 index 000000000..f3d8ca2bf --- /dev/null +++ b/content/yaml-code-signing/signing-ios-automatic.md @@ -0,0 +1,52 @@ +--- +title: Signing iOS apps automatically +description: How to set up iOS code signing in using automatic code signing in codemagic.yaml +weight: 1 +aliases: [../code-signing-yaml/signing, /code-signing-yaml/signing-ios, code-signing-identities, ../yaml-code-signing/code-signing-identities] +--- + +All iOS applications have to be digitally signed before they can be installed on real devices or made available to the public. + +### Automatic code signing + +In **Automatic code signing**, Codemagic takes care of Certificate and Provisioning profile management for you. Based on the `Certificate private key` that you provide, Codemagic will automatically fetch the correct certificate from the App Store or create a new one if necessary. + +When automatic code signing is used, then most up-to-date signing files are obtained directly from Apple during the build time. This requires that Codemagic has access to your Apple Developer portal account, which is achieved by using App Store Connect API key. + +{{}} +Signing iOS applications requires [Apple Developer Program](https://developer.apple.com/programs/enroll/) membership. +{{}} + + +#### Creating the App Store Connect API key + +{{< include "/partials/app-store-connect-api-key.md" >}} + +{{< include "/partials/code-signing-ios-obtain-certificate.md" >}} + +{{< include "/partials/code-signing-ios-configure-environment-vars.md" >}} + +Finally, to code sign the app, add the following commands in the [`scripts`](../getting-started/yaml#scripts) section of the configuration file, after all the dependencies are installed, right before the build commands. + +{{< highlight yaml "style=paraiso-dark">}} + scripts: + - name: Set up keychain to be used for code signing using Codemagic CLI 'keychain' command + script: keychain initialize + - name: Fetch signing files + script: | + app-store-connect fetch-signing-files "$BUNDLE_ID" \ + --type IOS_APP_STORE \ + --create + - name: Set up signing certificate + script: keychain add-certificates + - name: Set up code signing settings on Xcode project + script: xcode-project use-profiles +{{< /highlight >}} + +Instead of specifying the exact bundle-id, you can use `"$(xcode-project detect-bundle-id)"`. + +Based on the specified bundle ID and [provisioning profile type](https://github.com/codemagic-ci-cd/cli-tools/blob/master/docs/app-store-connect/fetch-signing-files.md#--typeios_app_adhoc--ios_app_development--ios_app_inhouse--ios_app_store--mac_app_development--mac_app_direct--mac_app_store--mac_catalyst_app_development--mac_catalyst_app_direct--mac_catalyst_app_store--tvos_app_adhoc--tvos_app_development--tvos_app_inhouse--tvos_app_store) set with the `--type` argument, Codemagic will fetch or create the relevant provisioning profile and certificate to code sign the build. + +If you are publishing to the **App Store** or you are using **TestFlight** to distribute your app to test users, set the `--type` argument to `IOS_APP_STORE`. + +When using a **third party app distribution service** such as Firebase App Distribution, set the `--type` argument to `IOS_APP_ADHOC` \ No newline at end of file diff --git a/content/yaml-code-signing/signing-ios.md b/content/yaml-code-signing/signing-ios-manual.md similarity index 96% rename from content/yaml-code-signing/signing-ios.md rename to content/yaml-code-signing/signing-ios-manual.md index f29db95f1..e9c6503de 100644 --- a/content/yaml-code-signing/signing-ios.md +++ b/content/yaml-code-signing/signing-ios-manual.md @@ -1,6 +1,6 @@ --- -title: Signing iOS apps -description: How to set up iOS code signing in codemagic.yaml +title: Signing iOS apps manually +description: How to set up manuall iOS code signing in codemagic.yaml weight: 1 aliases: [../code-signing-yaml/signing, /code-signing-yaml/signing-ios, code-signing-identities, ../yaml-code-signing/code-signing-identities] --- @@ -39,7 +39,7 @@ Signing iOS applications requires [Apple Developer Program](https://developer.ap ### Adding the provisioning profile {{< include "/partials/quickstart/code-signing-ios-add-provisioning-profile.md" >}} -## Referencing certificates and profiles in codemagic.yaml +### Referencing certificates and profiles in codemagic.yaml Codemagic provides two means of fetching the required certificates and provisioning profiles during the build with the use of `codemagic.yaml`. Fetching can either be configured by specifying the distribution type and bundle identifier, or for more advanced use-cases, individual files can be fetched by their reference names. @@ -121,7 +121,7 @@ workflows: {{< /highlight >}} -## Using provisioning profiles +### Using provisioning profiles To apply the profiles to your project during the build, add the following script before your build scripts: