Deploy to dev and prod #130
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: main | |
concurrency: | |
group: main | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- ".fvm/**" | |
- "lib/**" | |
- "assets/**" | |
- "fonts/**" | |
- "web/**" | |
- "pubspec.yaml" | |
- "pubspec.lock" | |
- ".github/workflows/main.yml" | |
pull_request: | |
# Set permissions to none. | |
# | |
# Using the broad default permissions is considered a bad security practice | |
# and would cause alerts from our scanning tools. | |
permissions: {} | |
jobs: | |
build_and_deploy: | |
runs-on: ubuntu-22.04 | |
permissions: | |
checks: write # for FirebaseExtended/action-hosting-deploy | |
strategy: | |
matrix: | |
environment: | |
- name: prod | |
firebaseServiceAccount: FIREBASE_SERVICE_ACCOUNT_ANKIGPT_PROD | |
projectId: ankigpt-prod | |
flavor: prod | |
- name: dev | |
firebaseServiceAccount: FIREBASE_SERVICE_ACCOUNT_ANKIGPT_DEV | |
projectId: ankigpt-dev | |
flavor: dev | |
steps: | |
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab | |
- name: Set Flutter version from FVM config file to environment variables | |
uses: kuhnroyal/flutter-fvm-config-action@e91317131a2da710b9cd9b7a24f2c0ade9eeb61d | |
- uses: subosito/flutter-action@main | |
with: | |
flutter-version: ${{ env.FLUTTER_VERSION }} | |
channel: ${{ env.FLUTTER_CHANNEL }} | |
- name: Build | |
run: | | |
flutter build web \ | |
--web-renderer canvaskit \ | |
--dart-define=RELEASE_DATE="$(date +"%B %e %Y")" \ | |
--dart-define=FLAVOR="${{ matrix.environment.flavor }}" | |
- uses: FirebaseExtended/action-hosting-deploy@120e124148ab7016bec2374e5050f15051255ba2 | |
with: | |
repoToken: "${{ secrets.GITHUB_TOKEN }}" | |
firebaseServiceAccount: "${{ secrets[matrix.environment.firebaseServiceAccount] }}" | |
channelId: live | |
target: ankigpt-app | |
projectId: "${{ matrix.environment.projectId }}" |