-
Notifications
You must be signed in to change notification settings - Fork 7
79 lines (69 loc) · 2.46 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: main
concurrency:
group: main
on:
push:
branches:
- main
paths:
- ".fvm/**"
- "lib/**"
- "assets/**"
- "fonts/**"
- "web/**"
- "pubspec.yaml"
- "pubspec.lock"
- ".github/workflows/main.yml"
- "firebase.json"
- ".firebaserc"
# 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:
name: build-and-deploy-${{ matrix.environment.name }}
runs-on: ubuntu-22.04
permissions:
checks: write # for FirebaseExtended/action-hosting-deploy
contents: "read" # for google-github-actions/auth
id-token: "write" # for google-github-actions/auth
strategy:
matrix:
environment:
- name: prod
projectNumber: 41416187582
projectId: ankigpt-prod
flavor: prod
- name: dev
projectNumber: 531541464051
projectId: ankigpt-dev
flavor: dev
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- name: Set Flutter version from FVM config file to environment variables
id: fvm-config-action
uses: kuhnroyal/flutter-fvm-config-action@6ffa30473b346f7d7c63cf9e03e6a886f940a72b
- uses: subosito/flutter-action@2783a3f08e1baf891508463f8c6653c258246225
with:
flutter-version: ${{ steps.fvm-config-action.outputs.FLUTTER_VERSION }}
channel: ${{ steps.fvm-config-action.outputs.FLUTTER_CHANNEL }}
- name: Install Firebase CLI
run: npm install -g [email protected]
- name: Build
run: |
flutter build web \
--web-renderer canvaskit \
--dart-define=RELEASE_DATE="$(date +"%B %e %Y")" \
--dart-define=FLAVOR="${{ matrix.environment.flavor }}"
- id: auth
uses: google-github-actions/auth@f6de81663f7788d05bd15bcce18f0e57f23f0846
with:
workload_identity_provider: "projects/${{ matrix.environment.projectNumber }}/locations/global/workloadIdentityPools/github/providers/github-provider"
service_account: "firebase-hosting-deployer@${{ matrix.environment.projectId }}.iam.gserviceaccount.com"
- name: Deploy
run: |
firebase deploy \
-P ${{ matrix.environment.projectId }} \
-m "Deploy from ${{ github.repository }} ${{ github.sha }}"