Skip to content

Commit

Permalink
pushing into test tracks and creating readme file for pipelines for a…
Browse files Browse the repository at this point in the history
…ndroid.
  • Loading branch information
Panosfunk committed Sep 2, 2024
1 parent eb2a247 commit b6160d0
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
4 changes: 2 additions & 2 deletions android/fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ 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"
sh "flutter pub upgrade"
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
Expand Down
44 changes: 35 additions & 9 deletions docs/app_store_deployment_pipeline.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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: |
Expand All @@ -111,29 +112,54 @@ 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"
sh "flutter pub upgrade"
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

0 comments on commit b6160d0

Please sign in to comment.