Skip to content

Commit

Permalink
feat(cd): enable deployments via GitHub releases (#128)
Browse files Browse the repository at this point in the history
* conf(gh): update cd.yml to deploy on new release

* conf(fastlane): update Fastfile to include beta & prod lanes

* conf(gh): run deploy job only if release is based on master

* conf(gh): check for "beta" in tag & not necessarily in end
  • Loading branch information
Nitish145 authored Aug 16, 2021
1 parent f43c8c7 commit e33e140
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 10 deletions.
19 changes: 12 additions & 7 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: CD

on:
push:
branches:
- deploy
on: [release]

env:
FB_APP_ID: ${{ secrets.FB_APP_ID }}
Expand All @@ -18,9 +15,17 @@ jobs:
deploy:
# This job will run on ubuntu virtual machine
runs-on: ubuntu-latest
# This job will run if the release is based on master branch
if: github.event.release.target_commitish == 'master'
steps:
# Setup Java environment in order to build the Android app.
- uses: actions/checkout@v1

# Extract the release type
- name: set release type
id: release
run: echo ::set-output name=type::${{ contains(github.event.release.tag_name, 'beta') && 'beta' || 'prod' }}

# Setup Java environment in order to build the Android apps
- uses: actions/setup-java@v1
with:
java-version: "12.x"
Expand Down Expand Up @@ -60,8 +65,8 @@ jobs:
# Build appbundle.
- run: flutter build appbundle --dart-define=FB_APP_ID=${FB_APP_ID} --dart-define=FB_APP_NAME=${FB_APP_NAME} --dart-define=GITHUB_OAUTH_CLIENT_ID=${GITHUB_OAUTH_CLIENT_ID} --dart-define=GITHUB_OAUTH_CLIENT_SECRET=${GITHUB_OAUTH_CLIENT_SECRET}

# Run fastlane internal
# Ship the appbundle.
- uses: maierj/fastlane-action@v1.4.0
with:
lane: internal
lane: ${{ release.outputs.type }}
subdirectory: android
14 changes: 11 additions & 3 deletions android/fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,18 @@
default_platform(:android)

platform :android do
desc "Push a new internal build to Play Store"
lane :internal do
desc "Push a new beta build to Play Store"
lane :beta do
upload_to_play_store(
track: "internal",
track: "beta",
aab: "../build/app/outputs/bundle/release/app-release.aab"
)
end

desc "Push a new production build to Play Store"
lane :prod do
upload_to_play_store(
track: "production",
aab: "../build/app/outputs/bundle/release/app-release.aab"
)
end
Expand Down

0 comments on commit e33e140

Please sign in to comment.