diff --git a/.github/workflows/deploy_to_google_play_store_fastlane_release.yml b/.github/workflows/deploy_to_google_play_store_fastlane_release.yml index 56e49c3b..167256a1 100644 --- a/.github/workflows/deploy_to_google_play_store_fastlane_release.yml +++ b/.github/workflows/deploy_to_google_play_store_fastlane_release.yml @@ -4,7 +4,8 @@ run-name: ${{github.actor}} is pushing to branch and deploying to Google Store on: push: branches: - - panosfunk/* + - master + - '**'' jobs: build: runs-on: ubuntu-latest @@ -59,13 +60,14 @@ jobs: PLAY_STORE_CONFIG_JSON: ${{secrets.PLAY_STORE_CONFIG_JSON}} working-directory: android - - # - run: fastlane release - # env: - # PLAY_STORE_JSON_KEY: PLAY_STORE_CONFIG.json - # working-directory: android + - if: github.ref == 'refs/heads/master' + run: fastlane release + env: + PLAY_STORE_JSON_KEY: PLAY_STORE_CONFIG.json + working-directory: android - - run: fastlane promote_internal_to_closed + - if: github.ref != 'refs/heads/master' + run: fastlane promote_internal_to_closed env: PLAY_STORE_JSON_KEY: PLAY_STORE_CONFIG.json working-directory: android \ No newline at end of file diff --git a/android/fastlane/Fastfile b/android/fastlane/Fastfile index 83fa51f1..1a1c14a2 100644 --- a/android/fastlane/Fastfile +++ b/android/fastlane/Fastfile @@ -21,7 +21,7 @@ platform :android do gradle(task: "test") end - desc "Submit a new release build to Google Play's Beta track" + desc "Submit a new release build to Google Play's Production track" lane :release do sh "flutter clean" sh "flutter pub get" @@ -29,7 +29,7 @@ platform :android do sh "flutter build appbundle --release --no-deferred-components --no-tree-shake-icons" upload_to_play_store( - track: 'beta', + track: 'production', aab: '../build/app/outputs/bundle/release/app-release.aab', ) end diff --git a/docs/app_store_deployment_pipeline.md b/docs/app_store_deployment_pipeline.md index f3b7d487..7ab98def 100644 --- a/docs/app_store_deployment_pipeline.md +++ b/docs/app_store_deployment_pipeline.md @@ -41,6 +41,7 @@ When action is run. push: branches: - master + - '**'' This action checks-out your repository under $GITHUB_WORKSPACE, so your workflow can access it. @@ -93,7 +94,7 @@ This action downloads a prebuilt ruby and adds it to the PATH. bundler-cache: true working-directory: android -These commands create the `upload-keystore.jks`, `PLAY_STORE_CONFIG.json` and the `key.properties` files which are essensial for signing the app as the developer account `Copenhagen Research Platform @ DTU Health Tech`. These files contain variables saved as secrets in the Github repo. +These commands create the `upload-keystore.jks`, `PLAY_STORE_CONFIG.json` and the `key.properties` files which are essential for signing the app as the developer account `Copenhagen Research Platform @ DTU Health Tech`. These files contain variables saved as secrets in the Github repo. - name: Configure Keystore run: | @@ -111,21 +112,31 @@ These commands create the `upload-keystore.jks`, `PLAY_STORE_CONFIG.json` and th PLAY_STORE_CONFIG_JSON: ${{secrets.PLAY_STORE_CONFIG_JSON}} working-directory: android -This command looks for a `Fastfile` which should be located under `android/fastlane/` +These commands look for a `Fastfile` which should be located under `android/fastlane/`. +If changes were pushed into master then `fastlane release` is called, otherwise `fastlane promote_internal_to_closed` is called, but that combination of test tracks can be changed to anything and is arbitrary. - - run: fastlane release - env: - PLAY_STORE_JSON_KEY: PLAY_STORE_CONFIG.json - working-directory: android + - if: github.ref == 'refs/heads/master' + run: fastlane release + env: + PLAY_STORE_JSON_KEY: PLAY_STORE_CONFIG.json + working-directory: android + + - if: github.ref != 'refs/heads/master' + run: fastlane promote_internal_to_closed + env: + PLAY_STORE_JSON_KEY: PLAY_STORE_CONFIG.json + working-directory: android ### Fastfile +The first 3 commands are essential for creating a new clean flutter build. `flutter build appbundle --release` creates a new .aab file that is built in release mode. Deferred components are parts of an app that can be downloaded after the initial installation to reduce the initial download size. `--no-tree-shake-icons` is usually used when building for production. + +Lastly upload_to_play_store() is a fastlane command. One of the tracks (production, open, closed, internal) is selected with the default being production (yikes) as well as the path location of the .aab created with the `flutter build appbundle --release --no-deferred-components --no-tree-shake-icons` command. - # - desc "Submit a new release build to Google Play's Beta track" + desc "Submit a new release build to Google Play's Production track" lane :release do sh "flutter clean" sh "flutter pub get" @@ -133,7 +144,22 @@ This command looks for a `Fastfile` which should be located under `android/fastl sh "flutter build appbundle --release --no-deferred-components --no-tree-shake-icons" upload_to_play_store( - track: 'beta', + track: 'production', + aab: '../build/app/outputs/bundle/release/app-release.aab', + ) + end + +Similarly we can upload to test tracks using the following commands. Here we upload a bundle to the internal testing track and also promote it to the closed testing track. + + desc "Promote internal track to closed" + lane :promote_internal_to_closed do + sh "flutter clean" + sh "flutter pub get" + sh "flutter pub upgrade" + sh "flutter build appbundle --release --no-deferred-components --no-tree-shake-icons" + upload_to_play_store( + track: 'internal', + track_promote_to: 'closed', aab: '../build/app/outputs/bundle/release/app-release.aab', ) end