From 6bdb493c20dd8ed3346bfe9eebbb6fc519492247 Mon Sep 17 00:00:00 2001 From: Jagandeep Brar Date: Wed, 19 Jan 2022 01:12:45 -0500 Subject: [PATCH] new(ci): Option to deploy to store fronts (default: true) --- ...ld_all_platforms.yml => all_platforms.yml} | 37 +++++++++++++------ .github/workflows/build_android.yml | 14 +++---- .github/workflows/build_ios.yml | 14 +++---- .github/workflows/build_macos.yml | 14 +++---- .github/workflows/deploy_android.yml | 16 ++++---- .github/workflows/deploy_ios.yml | 16 ++++---- .github/workflows/deploy_macos.yml | 16 ++++---- android/fastlane/Fastfile | 4 +- ios/fastlane/Fastfile | 2 +- macos/fastlane/Fastfile | 2 +- 10 files changed, 77 insertions(+), 58 deletions(-) rename .github/workflows/{build_all_platforms.yml => all_platforms.yml} (80%) diff --git a/.github/workflows/build_all_platforms.yml b/.github/workflows/all_platforms.yml similarity index 80% rename from .github/workflows/build_all_platforms.yml rename to .github/workflows/all_platforms.yml index b9d959b8..b2fcd242 100644 --- a/.github/workflows/build_all_platforms.yml +++ b/.github/workflows/all_platforms.yml @@ -35,60 +35,70 @@ on: description: 'Build for macOS' default: "true" + deploy: + type: boolean + required: true + description: 'Deploy to Store Fronts?' + default: "true" + +env: + VERSION: ${{ (github.event.inputs || inputs).flavor }}-${{ github.sha }} + FLAVOR: ${{ github.event.inputs.flavor || 'internal' }} + jobs: build_android: if: ${{ (github.event.inputs.android || 'true') == 'true' }} uses: CometTools/LunaSea/.github/workflows/build_android.yml@master - with: - flavor: ${{ github.event.inputs.flavor || 'internal' }} secrets: + FLAVOR: ${{ env.FLAVOR }} GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON }} KEY_JKS: ${{ secrets.KEY_JKS }} KEY_PROPERTIES: ${{ secrets.KEY_PROPERTIES }} + VERSION: ${{ env.VERSION }} build_ios: if: ${{ (github.event.inputs.ios || 'true') == 'true' }} uses: CometTools/LunaSea/.github/workflows/build_ios.yml@master - with: - flavor: ${{ github.event.inputs.flavor || 'internal' }} secrets: APPLE_ID: ${{ secrets.APPLE_ID }} APPLE_ITC_TEAM_ID: ${{ secrets.APPLE_ITC_TEAM_ID }} APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} + FLAVOR: ${{ env.FLAVOR }} GOOGLE_SERVICE_INFO_PLIST: ${{ secrets.GOOGLE_SERVICE_INFO_PLIST }} MATCH_KEYCHAIN_NAME: ${{ secrets.MATCH_KEYCHAIN_NAME }} MATCH_KEYCHAIN_PASSWORD: ${{ secrets.MATCH_KEYCHAIN_PASSWORD }} MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} MATCH_SSH_PRIVATE_KEY: ${{ secrets.MATCH_SSH_PRIVATE_KEY }} + VERSION: ${{ env.VERSION }} build_macos: if: ${{ (github.event.inputs.macos || 'true') == 'true' }} uses: CometTools/LunaSea/.github/workflows/build_macos.yml@master - with: - flavor: ${{ github.event.inputs.flavor || 'internal' }} secrets: APPLE_ID: ${{ secrets.APPLE_ID }} APPLE_ITC_TEAM_ID: ${{ secrets.APPLE_ITC_TEAM_ID }} APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} + FLAVOR: ${{ env.FLAVOR }} GOOGLE_SERVICE_INFO_PLIST: ${{ secrets.GOOGLE_SERVICE_INFO_PLIST }} MATCH_KEYCHAIN_NAME: ${{ secrets.MATCH_KEYCHAIN_NAME }} MATCH_KEYCHAIN_PASSWORD: ${{ secrets.MATCH_KEYCHAIN_PASSWORD }} MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} MATCH_SSH_PRIVATE_KEY: ${{ secrets.MATCH_SSH_PRIVATE_KEY }} + VERSION: ${{ env.VERSION }} deploy_android: needs: build_android + if: ${{ (github.event.inputs.deploy || 'true') == 'true' }} uses: CometTools/LunaSea/.github/workflows/deploy_android.yml@master - with: - flavor: ${{ github.event.inputs.flavor || 'internal' }} secrets: + FLAVOR: ${{ env.FLAVOR }} GOOGLE_PLAY_API: ${{ secrets.GOOGLE_PLAY_API }} + VERSION: ${{ env.VERSION }} deploy_ios: needs: build_ios + if: ${{ (github.event.inputs.deploy || 'true') == 'true' }} uses: CometTools/LunaSea/.github/workflows/deploy_ios.yml@master - with: - flavor: ${{ github.event.inputs.flavor || 'internal' }} secrets: APPLE_ID: ${{ secrets.APPLE_ID }} APPLE_ITC_TEAM_ID: ${{ secrets.APPLE_ITC_TEAM_ID }} @@ -97,12 +107,13 @@ jobs: APPLE_STORE_CONNECT_KEY_ID: ${{ secrets.APPLE_STORE_CONNECT_KEY_ID }} APPLE_STORE_CONNECT_ISSUER_ID: ${{ secrets.APPLE_STORE_CONNECT_ISSUER_ID }} APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} + FLAVOR: ${{ env.FLAVOR }} + VERSION: ${{ env.VERSION }} deploy_macos: needs: build_macos + if: ${{ (github.event.inputs.deploy || 'true') == 'true' }} uses: CometTools/LunaSea/.github/workflows/deploy_macos.yml@master - with: - flavor: ${{ github.event.inputs.flavor || 'internal' }} secrets: APPLE_ID: ${{ secrets.APPLE_ID }} APPLE_ITC_TEAM_ID: ${{ secrets.APPLE_ITC_TEAM_ID }} @@ -111,3 +122,5 @@ jobs: APPLE_STORE_CONNECT_KEY_ID: ${{ secrets.APPLE_STORE_CONNECT_KEY_ID }} APPLE_STORE_CONNECT_ISSUER_ID: ${{ secrets.APPLE_STORE_CONNECT_ISSUER_ID }} APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} + FLAVOR: ${{ env.FLAVOR }} + VERSION: ${{ env.VERSION }} diff --git a/.github/workflows/build_android.yml b/.github/workflows/build_android.yml index 01c12925..c6632811 100644 --- a/.github/workflows/build_android.yml +++ b/.github/workflows/build_android.yml @@ -1,18 +1,18 @@ -name: '[Android] Build' +name: '[Build] Android' on: workflow_call: - inputs: - flavor: - required: true - type: string secrets: + FLAVOR: + required: true GOOGLE_SERVICES_JSON: required: true KEY_JKS: required: true KEY_PROPERTIES: required: true + VERSION: + required: true jobs: build: @@ -29,7 +29,7 @@ jobs: - name: Set Flavor working-directory: ${{ github.workspace }} run: | - echo $'FLAVOR=${{ (github.event.inputs || inputs).flavor }}\nCOMMIT=${{ github.sha }}' > .flavor + echo $'FLAVOR=${{ secrets.FLAVOR }}\nCOMMIT=${{ github.sha }}' > .flavor - name: Install Secret Keys working-directory: ${{ github.workspace }} @@ -69,5 +69,5 @@ jobs: - name: Upload App Bundle Artifact uses: actions/upload-artifact@v2 with: - name: android-${{ (github.event.inputs || inputs).flavor }}-${{ github.sha }} + name: android-${{ secrets.VERSION }} path: ${{ github.workspace }}/build/app/outputs/bundle/release/app-release.aab diff --git a/.github/workflows/build_ios.yml b/.github/workflows/build_ios.yml index 2255df48..7c1c6e0f 100644 --- a/.github/workflows/build_ios.yml +++ b/.github/workflows/build_ios.yml @@ -1,11 +1,7 @@ -name: '[iOS] Build' +name: '[Build] iOS' on: workflow_call: - inputs: - flavor: - required: true - type: string secrets: APPLE_ID: required: true @@ -13,6 +9,8 @@ on: required: true APPLE_TEAM_ID: required: true + FLAVOR: + required: true GOOGLE_SERVICE_INFO_PLIST: required: true MATCH_KEYCHAIN_NAME: @@ -23,6 +21,8 @@ on: required: true MATCH_SSH_PRIVATE_KEY: required: true + VERSION: + required: true jobs: build: @@ -39,7 +39,7 @@ jobs: - name: Set Flavor working-directory: ${{ github.workspace }} run: | - echo $'FLAVOR=${{ (github.event.inputs || inputs).flavor }}\nCOMMIT=${{ github.sha }}' > .flavor + echo $'FLAVOR=${{ secrets.FLAVOR }}\nCOMMIT=${{ github.sha }}' > .flavor - name: Select Xcode Version uses: maxim-lobanov/setup-xcode@v1 @@ -91,5 +91,5 @@ jobs: - name: Upload App Package Artifact uses: actions/upload-artifact@v2 with: - name: ios-${{ (github.event.inputs || inputs).flavor }}-${{ github.sha }} + name: ios-${{ secrets.VERSION }} path: ${{ github.workspace }}/ios/Runner.ipa diff --git a/.github/workflows/build_macos.yml b/.github/workflows/build_macos.yml index ff4bf15e..2312f69c 100644 --- a/.github/workflows/build_macos.yml +++ b/.github/workflows/build_macos.yml @@ -1,11 +1,7 @@ -name: '[macOS] Build' +name: '[Build] macOS' on: workflow_call: - inputs: - flavor: - required: true - type: string secrets: APPLE_ID: required: true @@ -13,6 +9,8 @@ on: required: true APPLE_TEAM_ID: required: true + FLAVOR: + required: true GOOGLE_SERVICE_INFO_PLIST: required: true MATCH_KEYCHAIN_NAME: @@ -23,6 +21,8 @@ on: required: true MATCH_SSH_PRIVATE_KEY: required: true + VERSION: + required: true jobs: build: @@ -39,7 +39,7 @@ jobs: - name: Set Flavor working-directory: ${{ github.workspace }} run: | - echo $'FLAVOR=${{ (github.event.inputs || inputs).flavor }}\nCOMMIT=${{ github.sha }}' > .flavor + echo $'FLAVOR=${{ secrets.FLAVOR }}\nCOMMIT=${{ github.sha }}' > .flavor - name: Select Xcode Version uses: maxim-lobanov/setup-xcode@v1 @@ -92,5 +92,5 @@ jobs: - name: Upload App Package Artifact uses: actions/upload-artifact@v2 with: - name: macos-${{ (github.event.inputs || inputs).flavor }}-${{ github.sha }} + name: macos-${{ secrets.VERSION }} path: ${{ github.workspace }}/macos/LunaSea.pkg diff --git a/.github/workflows/deploy_android.yml b/.github/workflows/deploy_android.yml index 5a9287e2..05d035dd 100644 --- a/.github/workflows/deploy_android.yml +++ b/.github/workflows/deploy_android.yml @@ -1,19 +1,21 @@ -name: '[Android] Deploy' +name: '[Deploy] Android' on: workflow_call: - inputs: - flavor: - required: true - type: string secrets: + FLAVOR: + required: true GOOGLE_PLAY_API: required: true + VERSION: + required: true jobs: deploy: name: 'Deploy to Play Store' runs-on: macos-latest + env: + VERSION_NAME: android-${{ secrets.VERSION }} steps: - name: Checkout Repository @@ -25,7 +27,7 @@ jobs: - name: Download App Bundle Artifact uses: actions/download-artifact@v2 with: - name: android-${{ (github.event.inputs || inputs).flavor }}-${{ github.sha }} + name: ${{ env.VERSION_NAME }} path: ${{ github.workspace }} - name: Install Secret Keys @@ -42,4 +44,4 @@ jobs: SUPPLY_JSON_KEY: ${{ github.workspace }}/.fastlane-android-auth.json run: | bundle install - bundle exec fastlane deploy flavor:${{ (github.event.inputs || inputs).flavor }} aab:${{ github.workspace }}/app-release.aab + bundle exec fastlane deploy track:${{ secrets.FLAVOR }} aab:${{ github.workspace }}/app-release.aab version_name:${{ env.VERSION_NAME }} diff --git a/.github/workflows/deploy_ios.yml b/.github/workflows/deploy_ios.yml index 6662358b..339d69e9 100644 --- a/.github/workflows/deploy_ios.yml +++ b/.github/workflows/deploy_ios.yml @@ -1,11 +1,7 @@ -name: '[iOS] Deploy' +name: '[Deploy] iOS' on: workflow_call: - inputs: - flavor: - required: true - type: string secrets: APPLE_ID: required: true @@ -21,11 +17,17 @@ on: required: true APPLE_TEAM_ID: required: true + FLAVOR: + required: true + VERSION: + required: true jobs: deploy: name: 'Deploy to App Store' runs-on: macos-latest + env: + VERSION_NAME: android-${{ secrets.VERSION }} steps: - name: Checkout Repository @@ -37,7 +39,7 @@ jobs: - name: Download App Package Artifact uses: actions/download-artifact@v2 with: - name: ios-${{ (github.event.inputs || inputs).flavor }}-${{ github.sha }} + name: ${{ env.VERSION_NAME }} path: ${{ github.workspace }} - name: Install Secret Keys @@ -59,4 +61,4 @@ jobs: APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} run: | bundle install - bundle exec fastlane deploy flavor:${{ (github.event.inputs || inputs).flavor }} ipa:${{ github.workspace }}/Runner.ipa + bundle exec fastlane deploy groups:${{ secrets.FLAVOR }} ipa:${{ github.workspace }}/Runner.ipa diff --git a/.github/workflows/deploy_macos.yml b/.github/workflows/deploy_macos.yml index cbef32be..6d1a5cc8 100644 --- a/.github/workflows/deploy_macos.yml +++ b/.github/workflows/deploy_macos.yml @@ -1,11 +1,7 @@ -name: '[macOS] Deploy' +name: '[Deploy] macOS' on: workflow_call: - inputs: - flavor: - required: true - type: string secrets: APPLE_ID: required: true @@ -21,11 +17,17 @@ on: required: true APPLE_TEAM_ID: required: true + FLAVOR: + required: true + VERSION: + required: true jobs: deploy: name: 'Deploy to App Store' runs-on: macos-latest + env: + VERSION_NAME: macos-${{ secrets.VERSION }} steps: - name: Checkout Repository @@ -37,7 +39,7 @@ jobs: - name: Download App Package Artifact uses: actions/download-artifact@v2 with: - name: macos-${{ (github.event.inputs || inputs).flavor }}-${{ github.sha }} + name: ${{ env.VERSION_NAME }} path: ${{ github.workspace }} - name: Install Secret Keys @@ -59,4 +61,4 @@ jobs: APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} run: | bundle install - bundle exec fastlane deploy flavor:${{ (github.event.inputs || inputs).flavor }} pkg:${{ github.workspace }}/LunaSea.pkg + bundle exec fastlane deploy groups:${{ secrets.FLAVOR }} pkg:${{ github.workspace }}/LunaSea.pkg diff --git a/android/fastlane/Fastfile b/android/fastlane/Fastfile index a5df0649..e8e08c56 100644 --- a/android/fastlane/Fastfile +++ b/android/fastlane/Fastfile @@ -14,8 +14,8 @@ platform :android do skip_upload_metadata: true, skip_upload_images: true, skip_upload_screenshots: true, - track: options[:flavor] || "internal", - version_name: "#{build_number}", + track: options[:track] || "internal", + version_name: options[:version_name] || "#{build_number}", ) end diff --git a/ios/fastlane/Fastfile b/ios/fastlane/Fastfile index 337705ee..0ed0aaf2 100644 --- a/ios/fastlane/Fastfile +++ b/ios/fastlane/Fastfile @@ -45,7 +45,7 @@ platform :ios do upload_to_testflight( changelog: "The changelog is available within the application!", distribute_external: true, - groups: options[:flavor] || "internal", + groups: options[:groups] || "internal", ipa: options[:ipa] || "../ios/Runner.ipa", notify_external_testers: true, reject_build_waiting_for_review: true, diff --git a/macos/fastlane/Fastfile b/macos/fastlane/Fastfile index 53b556fc..aab5472b 100644 --- a/macos/fastlane/Fastfile +++ b/macos/fastlane/Fastfile @@ -46,7 +46,7 @@ platform :mac do upload_to_testflight( changelog: "The changelog is available within the application!", distribute_external: true, - groups: options[:flavor] || "internal", + groups: options[:groups] || "internal", pkg: options[:pkg] || "../macos/LunaSea.pkg", notify_external_testers: true, reject_build_waiting_for_review: true,