From 6adc0f3a0516ec65a0934c40cb27135cbd4dc91f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karol=20Szafra=C5=84ski?= Date: Thu, 19 Dec 2024 10:24:08 +0100 Subject: [PATCH] Merge two iOS workflows into one --- .github/workflows/ios-app-build-manual.yaml | 89 -------------------- .github/workflows/ios-app-build-on-push.yaml | 23 +++++ .github/workflows/ios-app-build.yaml | 13 ++- 3 files changed, 32 insertions(+), 93 deletions(-) delete mode 100644 .github/workflows/ios-app-build-manual.yaml create mode 100644 .github/workflows/ios-app-build-on-push.yaml diff --git a/.github/workflows/ios-app-build-manual.yaml b/.github/workflows/ios-app-build-manual.yaml deleted file mode 100644 index 1f1ccc5..0000000 --- a/.github/workflows/ios-app-build-manual.yaml +++ /dev/null @@ -1,89 +0,0 @@ -name: Manual iOS app build - -on: - workflow_dispatch: - inputs: - build_type: - description: '`debug` or `release`' - required: true - default: 'debug' - -jobs: - build-ios: - runs-on: macos-latest - name: Build iOS application - environment: 'iOS app signing' - steps: - - - name: Install the Apple certificate and provisioning profile - env: - BUILD_CERTIFICATE_BASE64: ${{ github.event.inputs.build_type == 'release' && secrets.RELEASE_BUILD_CERTIFICATE_BASE64 || secrets.BUILD_CERTIFICATE_BASE64 }} - P12_PASSWORD: ${{ secrets.P12_PASSWORD }} - BUILD_PROVISION_PROFILE_BASE64: ${{ github.event.inputs.build_type == 'release' && secrets.RELEASE_BUILD_PROVISION_PROFILE_BASE64 || secrets.BUILD_PROVISION_PROFILE_BASE64 }} - KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} - run: | - # create variables - CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12 - PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision - KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db - - # import certificate and provisioning profile from secrets - echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode --output $CERTIFICATE_PATH - echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode --output $PP_PATH - - # create temporary keychain - security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH - security set-keychain-settings -lut 21600 $KEYCHAIN_PATH - security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH - - # import certificate to keychain - security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH - security list-keychain -d user -s $KEYCHAIN_PATH - - # apply provisioning profile - mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles - cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles - - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 1 - - - name: Install tabris-cli - run: npm install -g tabris-cli - - - name: Install application dependencies - env: - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - run: | - npm run --if-present prepare - npm install - - - name: Build application - env: - TABRIS_BUILD_KEY: ${{ secrets.TABRIS_IOS_BUILD_KEY }} - run: | - tabris build ios --${{ github.event.inputs.build_type }} --device --verbose - - - name: Prepare artifacts for archival - run: | - mkdir -p artifacts - printenv | grep GITHUB_ > artifacts/env-gha - cp -R \ - "$(find . -iname "*.app.dSYM")" \ - "$(find . -iname "*.ipa")" \ - artifacts - tar cf artifacts.tar artifacts - - - name: Archive metadata - uses: actions/upload-artifact@v3 - with: - name: artifacts.tar - path: artifacts.tar - retention-days: 30 - - - name: Cleanup - if: always() - run: | - security delete-keychain $RUNNER_TEMP/app-signing.keychain-db - rm ~/Library/MobileDevice/Provisioning\ Profiles/build_pp.mobileprovision diff --git a/.github/workflows/ios-app-build-on-push.yaml b/.github/workflows/ios-app-build-on-push.yaml new file mode 100644 index 0000000..9b37476 --- /dev/null +++ b/.github/workflows/ios-app-build-on-push.yaml @@ -0,0 +1,23 @@ +name: Trigger iOS build + +on: + push: + +jobs: + trigger: + name: Trigger new iOS build + environment: 'es-fastlane-match' + runs-on: ubuntu-latest + steps: + - name: Trigger new build + run: | + curl -v \ + https://api.github.com/repos/eclipsesource/tabris-remote-app/actions/workflows/ios-app-build.yaml/dispatches \ + -H 'Accept: application/vnd.github.v3+json' \ + -H 'Content-Type: application/json' \ + -H "Authorization: token ${{ secrets.ES_GITHUB_TOKEN }}" \ + -H 'cache-control: no-cache' \ + -d "{ + \"ref\": \"${{ github.ref }}\" + \"build_type\": \"release\" + }" diff --git a/.github/workflows/ios-app-build.yaml b/.github/workflows/ios-app-build.yaml index b9484ed..723f5f3 100644 --- a/.github/workflows/ios-app-build.yaml +++ b/.github/workflows/ios-app-build.yaml @@ -1,7 +1,12 @@ name: Build iOS app on: - push: + workflow_dispatch: + inputs: + build_type: + description: '`debug` or `release`' + required: true + default: 'debug' jobs: build-ios: @@ -12,9 +17,9 @@ jobs: - name: Install the Apple certificate and provisioning profile env: - BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }} + BUILD_CERTIFICATE_BASE64: ${{ github.event.inputs.build_type == 'release' && secrets.RELEASE_BUILD_CERTIFICATE_BASE64 || secrets.BUILD_CERTIFICATE_BASE64 }} P12_PASSWORD: ${{ secrets.P12_PASSWORD }} - BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }} + BUILD_PROVISION_PROFILE_BASE64: ${{ github.event.inputs.build_type == 'release' && secrets.RELEASE_BUILD_PROVISION_PROFILE_BASE64 || secrets.BUILD_PROVISION_PROFILE_BASE64 }} KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} run: | # create variables @@ -58,7 +63,7 @@ jobs: env: TABRIS_BUILD_KEY: ${{ secrets.TABRIS_IOS_BUILD_KEY }} run: | - tabris build ios --debug --device --verbose + tabris build ios --${{ github.event.inputs.build_type }} --device --verbose - name: Prepare artifacts for archival run: |