-
Notifications
You must be signed in to change notification settings - Fork 1
100 lines (82 loc) · 2.79 KB
/
trunk.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# For more information see: https://github.com/marketplace/actions/flutter-action
name: trunk
on:
push:
branches: [main]
defaults:
run:
shell: bash
concurrency:
group: ${{ github.head_ref }}.${{ github.sha }}.trunk
cancel-in-progress: true
jobs:
checks:
runs-on: ubuntu-latest
outputs:
origin: ${{ steps.check-origin.outputs.origin }}
steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Check origin
id: check-origin
uses: ./.github/actions/check-origin
trunk:
needs: checks
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Detect changes
uses: dorny/paths-filter@v2
id: changes
with:
filters: |
src:
- '.github/workflows/trunk.yml'
- 'lib/**'
- 'test/**'
- 'android/**'
- 'ios/**'
- 'analysis_options.yaml'
- '.metadata'
- 'pubspec.yaml'
- 'pubspec.lock'
- name: Setup environment
if: ${{ steps.changes.outputs.src == 'true' }}
uses: ./.github/actions/setup-environment
with:
src: ${{ steps.changes.outputs.src }}
- name: Create .env
if: ${{ steps.changes.outputs.src == 'true' && needs.checks.outputs.origin == 'true' }}
shell: bash
run: |
echo "SENTRY_DSN='$SENTRY_DSN'" > ./.env
echo "FIRE_API_KEY='$FIRE_API_KEY'" >> ./.env
echo "FIRE_APP_ID='$FIRE_APP_ID'" >> ./.env
echo "FIRE_MESSAGING_SENDER_ID='$FIRE_MESSAGING_SENDER_ID'" >> ./.env
echo "FIRE_PROJECT_ID='$FIRE_PROJECT_ID'" >> ./.env
env:
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
FIRE_API_KEY: ${{ secrets.FIRE_API_KEY }}
FIRE_APP_ID: ${{ secrets.FIRE_APP_ID }}
FIRE_MESSAGING_SENDER_ID: ${{ secrets.FIRE_MESSAGING_SENDER_ID }}
FIRE_PROJECT_ID: ${{ secrets.FIRE_PROJECT_ID }}
- name: Analyze
if: ${{ steps.changes.outputs.src == 'true' }}
run: flutter analyze
- name: Run tests
if: ${{ steps.changes.outputs.src == 'true' }}
run: flutter test
- name: Create google-services.json
if: ${{ steps.changes.outputs.src == 'true' && needs.checks.outputs.origin == 'true' }}
run: jq -n "$GOOGLE_SERVICES_JSON" > ./android/app/google-services.json
env:
GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON }}
- name: Build APK
if: ${{ steps.changes.outputs.src == 'true' && needs.checks.outputs.origin == 'true' }}
run: flutter build apk
- name: Cleanup
if: always()
uses: ./.github/actions/cleanup-environment