From fe70188bb7f1e63c86530f2d50cbf4103a2e093f Mon Sep 17 00:00:00 2001 From: Vincent Frascello Date: Mon, 19 Sep 2022 07:49:55 -0700 Subject: [PATCH 1/5] Added XCode selection and console outputs --- Readme.MD | 38 ++++++++++++++++++++++---------------- action.yml | 23 +++++++++++++++++------ 2 files changed, 39 insertions(+), 22 deletions(-) diff --git a/Readme.MD b/Readme.MD index 096cb43..79809ac 100644 --- a/Readme.MD +++ b/Readme.MD @@ -1,13 +1,17 @@ -# XCode-Deploy 1.3 +# XCode-Deploy 1.4 This action will archive, export, and upload your project or workspace to App Store Connect (TestFlight). It is designed to run on a containerized VM, such as a GitHub Hosted Runner. If self-hosting, some of these steps may be unnecessary or redundant. ## Inputs +### `xcode-version` + +The version of XCode to use, in SemVer. Default is latest stable release: `xcode-latest`. See also [setup-xcode][0]. + ### `configuration` -The configuration to archive. Default is `'Release`. See also `xcodebuild`'s `-configuration`. +The configuration to archive. Default is `Release`. See also `xcodebuild`'s `-configuration`. ### `scheme` @@ -51,8 +55,9 @@ You can generate one of these by doing a local export in XCode and then copy it ## Sample Usage ```yml - name: Deploy - uses: vfrascello/xcode-deploy@v1.3 + uses: vfrascello/xcode-deploy@v1.4 with: + xcode-version: '14.0' configuration: 'Release' scheme: 'MyScheme' path-to-export-options: 'ExportOptions.plist' @@ -65,26 +70,27 @@ You can generate one of these by doing a local export in XCode and then copy it auth-key-p8: ${{ secrets.AUTH_KEY_P8 }} ``` -See [action.yml][0] for more details. +See [action.yml][1] for more details. ## Contributions This composite action was written by me, Vincent Frascello, but uses actions by other open-source contributors: -[Oliver Jones][1] +[Oliver Jones][2] -[Florian Fried][2] +[Florian Fried][3] -[Akio Jinsenji][3] +[Akio Jinsenji][4] -[Github Actions Team][4] +[Github Actions Team][5] ## License -Any contributions made under this project will be governed by the [MIT License][5]. - -[0]: https://github.com/vfrascello/xcode-deploy/blob/main/action.yml -[1]: https://github.com/orj -[2]: https://github.com/ffried -[3]: https://github.com/akiojin -[4]: https://github.com/actions -[5]: https://github.com/vfrascello/xcode-deploy/blob/main/LICENSE +Any contributions made under this project will be governed by the [MIT License][6]. + +[0]: https://github.com/maxim-lobanov/setup-xcode +[1]: https://github.com/vfrascello/xcode-deploy/blob/main/action.yml +[2]: https://github.com/orj +[3]: https://github.com/ffried +[4]: https://github.com/akiojin +[5]: https://github.com/actions +[6]: https://github.com/vfrascello/xcode-deploy/blob/main/LICENSE diff --git a/action.yml b/action.yml index 07ecb76..3d4bedf 100644 --- a/action.yml +++ b/action.yml @@ -6,6 +6,10 @@ branding: color: 'yellow' inputs: + xcode-version: + description: 'The version of XCode to use. Defaults to the latest stable version.' + requred: false + default: 'latest-stable' configuration: description: 'Configuration (default: Release)' required: true @@ -55,6 +59,7 @@ runs: CONFIGURATION: ${{ inputs.configuration }} PATH_TO_EXPORT_OPTIONS: ${{ inputs.path-to-export-options }} run: | + echo "[XCode-Deploy]: Checking Input for invalid characters..." if [[ "$SCHEME" == ${SCHEME//[^a-zA-Z0-9_\.- ]/} ]] && \ [[ "$CONFIGURATION" == ${CONFIGURATION//[^a-zA-Z0-9_\.- ]/} ]] && \ [[ "$PATH_TO_EXPORT_OPTIONS" == ${PATH_TO_EXPORT_OPTIONS//^[a-zA-Z0-9](?:[a-zA-Z0-9 ._-]*[a-zA-Z0-9])?\.[a-zA-Z0-9_-]+$/} ]]; then @@ -71,6 +76,7 @@ runs: - name: Determine File To Build shell: bash run: | + echo "[XCode-Deploy]: Determining file to build..." if [ "`ls -A | grep -i \\.xcworkspace\$`" ]; then filetype_parameter="workspace" \ && file_to_build="`ls -A | grep -i \\.xcworkspace\$`"; \ else filetype_parameter="project" && file_to_build="`ls -A | grep -i \\.xcodeproj\$`"; fi @@ -78,15 +84,17 @@ runs: echo "TYPE=$filetype_parameter" >> $GITHUB_ENV echo "FILE_TO_BUILD=$file_to_build" >> $GITHUB_ENV echo "PROJECT_NAME=$(echo "$file_to_build" | cut -f 1 -d '.')" >> $GITHUB_ENV - - name: Grab Default Scheme + - name: Setup Scheme shell: bash run: | + echo "[XCode-Deploy]: Searching for default Scheme..." if [ "${{ inputs.scheme }}" == "" ]; then scheme_list=$(xcodebuild -list -json | tr -d "\n") scheme=$(echo $scheme_list | ruby -e "require 'json'; puts JSON.parse(STDIN.gets)['project']['targets'][0]") echo $scheme | cat >scheme - echo Using default scheme: $scheme + echo "[XCode-Deploy]: Using default scheme: $scheme..." else + echo "[XCode-Deploy]: Using provided Scheme: ${{ inputs.scheme }}" scheme=${{ inputs.scheme }} fi echo "SCHEME=$scheme" >> $GITHUB_ENV @@ -102,14 +110,14 @@ runs: with: base64: ${{ inputs.app-store-provisioning-profile }} - name: Select Xcode - shell: bash - run: | - # needed until September 26 when 14 becomes default - sudo xcode-select --switch /Applications/Xcode_14.0.app + - uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: '14.0' - name: Increment Build Number shell: bash run: | if ${{ inputs.update-build }}; then + echo "[XCode-Deploy]: Updating Build Number to commit depth..." count=`git rev-list --count HEAD` xcrun agvtool new-version -all $count fi @@ -134,6 +142,7 @@ runs: - name: Export Xcode archive shell: bash run: | + echo "[XCode-Deploy]: Exporting archive using xcodebuild..." xcodebuild -exportArchive -verbose \ -sdk iphoneos \ -archivePath ${{ github.workspace }}/${{ env.PROJECT_NAME }}.xcarchive \ @@ -144,10 +153,12 @@ runs: - name: Upload to App Store Connect shell: bash run: | + echo "[XCode-Deploy]: Uploading archive using altool..." xcrun altool --upload-app -f ${{ github.workspace }}/${{ env.PROJECT_NAME }}.ipa -t iOS \ --apiIssuer ${{ inputs.auth-key-issuer-id }} --apiKey ${{ inputs.auth-key-id }} - name: Cleanup shell: bash run: | + echo "[XCode-Deploy]: Removing Keychain and private_keys folder..." security delete-keychain codesign.keychain rm -rf ${{ github.workspace }}/private_keys || true \ No newline at end of file From 0daf31d335193aa7ff4a65456a72c05f228c126b Mon Sep 17 00:00:00 2001 From: Vincent Frascello Date: Mon, 19 Sep 2022 07:55:44 -0700 Subject: [PATCH 2/5] Updated version of setup-xcode --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 3d4bedf..102b375 100644 --- a/action.yml +++ b/action.yml @@ -110,7 +110,7 @@ runs: with: base64: ${{ inputs.app-store-provisioning-profile }} - name: Select Xcode - - uses: maxim-lobanov/setup-xcode@v1 + uses: maxim-lobanov/setup-xcode@v1.4.1 with: xcode-version: '14.0' - name: Increment Build Number From 82e99273f0f8974dedc7173fceb50d58afdb6693 Mon Sep 17 00:00:00 2001 From: Vincent Frascello Date: Mon, 19 Sep 2022 08:01:56 -0700 Subject: [PATCH 3/5] Updated Readme. --- Readme.MD | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Readme.MD b/Readme.MD index 79809ac..5dbdb93 100644 --- a/Readme.MD +++ b/Readme.MD @@ -76,6 +76,8 @@ See [action.yml][1] for more details. This composite action was written by me, Vincent Frascello, but uses actions by other open-source contributors: +[Maxim Lobanov][0] + [Oliver Jones][2] [Florian Fried][3] From c25aa779300a1ef77917174e9925c0d193148f1e Mon Sep 17 00:00:00 2001 From: Vincent Frascello <59906016+vfrascello@users.noreply.github.com> Date: Mon, 10 Oct 2022 11:04:41 -0700 Subject: [PATCH 4/5] Added Cocoapods and SPM support. (#9) * Testing Cocoapods and SPM * Added Shell * removed bundler * testing conditional logic * adding echo and conditional logic * Fixed XCode Version and cleanup. Co-authored-by: Vincent Frascello --- action.yml | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index 102b375..ff0fe85 100644 --- a/action.yml +++ b/action.yml @@ -30,6 +30,22 @@ inputs: options: - true - false + install-pods: + description: 'Run Pod Install' + required: true + default: false + type: choice + options: + - true + - false + resolve-package-dependencies: + description: 'Resolve Package Dependencies' + required: true + default: false + type: choice + options: + - true + - false distribution-certificate-p12: description: 'base64 representation of the distribution certificate.' required: true @@ -84,6 +100,18 @@ runs: echo "TYPE=$filetype_parameter" >> $GITHUB_ENV echo "FILE_TO_BUILD=$file_to_build" >> $GITHUB_ENV echo "PROJECT_NAME=$(echo "$file_to_build" | cut -f 1 -d '.')" >> $GITHUB_ENV + - name: Setup Pods + if: inputs.install-pods == 'true' + shell: bash + run: | + echo "[XCode-Deploy]: Installing Pods..." + pod install + - name: Resolve Package Dependencies + if: inputs.resolve-package-dependencies == 'true' + shell: bash + run: | + echo "[XCode-Deploy]: Resolving Package Dependencies..." + xcodebuild -resolvePackageDependencies -clonedSourcePackagesDirPath . - name: Setup Scheme shell: bash run: | @@ -112,15 +140,14 @@ runs: - name: Select Xcode uses: maxim-lobanov/setup-xcode@v1.4.1 with: - xcode-version: '14.0' + xcode-version: ${{ inputs.xcode-version }} - name: Increment Build Number shell: bash + if: inputs.update-build == 'true' run: | - if ${{ inputs.update-build }}; then echo "[XCode-Deploy]: Updating Build Number to commit depth..." count=`git rev-list --count HEAD` xcrun agvtool new-version -all $count - fi - name: Build and Archive uses: sersoft-gmbh/xcodebuild-action@v2 with: From 31f5c01425cd38822c7d05bd069c1aca59f4d1a6 Mon Sep 17 00:00:00 2001 From: Vincent Frascello Date: Mon, 10 Oct 2022 11:08:10 -0700 Subject: [PATCH 5/5] Updated Readme. --- Readme.MD | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Readme.MD b/Readme.MD index 5dbdb93..be70895 100644 --- a/Readme.MD +++ b/Readme.MD @@ -1,4 +1,4 @@ -# XCode-Deploy 1.4 +# XCode-Deploy 1.5 This action will archive, export, and upload your project or workspace to App Store Connect (TestFlight). It is designed to run on a containerized VM, such as a GitHub Hosted Runner. If self-hosting, some of these steps may be unnecessary or redundant. @@ -25,6 +25,14 @@ The path to the `ExportOptions.plist` file, required for `-exportArchive`. Will A boolean value that will set the `version-number` to the commit depth. If false, nothing happens. See also `agvtool`'s `-new-version`. +### `install-pods` + +A boolean value that will run `pod install` if true. If false, nothing happens. + +### `resolve-package-dependencies` + +A boolean value that will run `xcodebuild -resolvePackageDependencies -clonedSourcePackagesDirPath .` if true. If false, nothing happens. + ### `distribution-certificate-p12` The `base64` representation of your Apple/iOS Distribution Certificate and private key pair. @@ -55,13 +63,15 @@ You can generate one of these by doing a local export in XCode and then copy it ## Sample Usage ```yml - name: Deploy - uses: vfrascello/xcode-deploy@v1.4 + uses: vfrascello/xcode-deploy@v1.5 with: xcode-version: '14.0' configuration: 'Release' scheme: 'MyScheme' path-to-export-options: 'ExportOptions.plist' update-build: true + install-pods: false + resolve-package-dependencies: true distribution-certificate-p12: ${{ secrets.DISTRIBUTION_CERTIFICATE_P12 }} distribution-certificate-password: ${{ secrets.DISTRIBUTION_CERTIFICATE_PASSWORD }} app-store-provisioning-profile: ${{ secrets.APPSTORE_PROVISIONING_PROFILE}}