Skip to content

CD

CD #29

Workflow file for this run

name: CD
on:
release:
types: [published]
env:
GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON }}
FIREBASE_OPTIONS: ${{ secrets.FIREBASE_OPTIONS }}
FIREBASE_APP_ID: ${{ secrets.FIREBASE_APP_ID }}
PROD_BASE_URL: ${{ secrets.PROD_BASE_URL }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
FASTLANE_SUPPLY_JSON_KEY: ${{ secrets.FASTLANE_SUPPLY_JSON_KEY }}
RELEASE_KEYSTORE: ${{ secrets.RELEASE_KEYSTORE }}
RELEASE_KEYSTORE_PROPERTIES: ${{ secrets.RELEASE_KEYSTORE_PROPERTIES }}
RELEASE_TYPE: ${{ contains(github.event.release.tag_name, 'internal') && 'internal' || contains(github.event.release.tag_name, 'beta') && 'beta' || 'prod' }}
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 == 'main'
steps:
# Setup Java environment in order to build the Android app.
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: "17.x"
# Setup Ruby for Fastlane
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6
bundler-cache: true
# Setup the flutter environment.
- uses: subosito/flutter-action@v2
with:
channel: "stable"
flutter-version: 3.19.0
# Get flutter dependencies.
- run: flutter pub get
# Generate Freezed models
- run: dart run build_runner build -d
# Check for any formatting issues in the code.
- run: dart format --set-exit-if-changed .
# Save firebase-options.dart
- run: echo "${FIREBASE_OPTIONS}" | base64 --decode > lib/firebase_options.dart
# Statically analyze the Dart code for any errors.
- run: flutter analyze .
# Save google-services.json
- run: echo "${GOOGLE_SERVICES_JSON}" | base64 --decode > android/app/google-services.json
# Save supply json key for fastlane
- run: echo "${FASTLANE_SUPPLY_JSON_KEY}" | base64 --decode > android/supply_json_key.json
# Save release props for signing
- run: echo "${RELEASE_KEYSTORE_PROPERTIES}" | base64 --decode > android/key.properties
# Save release keystore for signing
- run: echo "${RELEASE_KEYSTORE}" | base64 --decode > android/app/key.jks
# Save firebase_app_id_file.json
- run: echo "${FIREBASE_APP_ID}" | base64 --decode > ios/firebase_app_id_file.json
# Build appbundle.
- name: 'Build dev appbundle'
if: "contains(github.event.release.tag_name, 'internal')"
run: flutter build appbundle --dart-define=SENTRY_DSN=${SENTRY_DSN}
- name: 'Build prod appbundle'
if: "!contains(github.event.release.tag_name, 'internal')"
run: flutter build appbundle --dart-define=SENTRY_DSN=${SENTRY_DSN} --dart-define=BASE_URL=${PROD_BASE_URL} --dart-define=OAUTH_REDIRECT_URI=${PROD_BASE_URL}/oauth/
# Run fastlane internal
- uses: maierj/[email protected]
with:
lane: ${{ env.RELEASE_TYPE }}
subdirectory: android