-
Notifications
You must be signed in to change notification settings - Fork 0
98 lines (81 loc) · 3.27 KB
/
release.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
name: build and release
on:
push:
branches: [ "main" ]
jobs:
build:
name: build and release
runs-on: macos-latest
permissions:
contents: write
steps:
- name: checkout source
uses: actions/checkout@v4
- name: set up flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable'
flutter-version-file: pubspec.yaml
cache: true
- name: print flutter version
run: flutter --version
- name: get dependencies
run: flutter pub get
- name: prepare sensitive data
run: |
echo "${{ secrets.FIREBASE_OPTIONS_DART }}" | base64 -d >> ./lib/firebase_options.dart
echo "${{ secrets.GOOGLE_SERVICE_JSON }}" | base64 -d >> ./android/app/google-services.json
echo "${{ secrets.RELEASE_KEYSTORE }}" | base64 -d >> ./android/app/chrono-sheet.jks
echo "storeFile=chrono-sheet.jks" >> ./android/key.properties
echo "storePassword=${{ secrets.RELEASE_KEYSTORE_PASSWORD }}" >> ./android/key.properties
echo "keyPassword=${{ secrets.RELEASE_KEYSTORE_PASSWORD }}" >> ./android/key.properties
echo "keyAlias=${{ secrets.RELEASE_KEYSTORE_KEY }}" >> ./android/key.properties
echo "${{ secrets.INFO_PLIST }}" | base64 -d >> ./ios/Runner/Info.plist
echo "${{ secrets.GOOGLE_SERVICE_INFO_PLIST }}" | base64 -d >> ./ios/Runner/GoogleService-Info.plist
echo "${{ secrets.IPHONE_CERTIFICATE_P12 }}" | base64 -d >> $RUNNER_TEMP/build_certificate.p12
- name: generate l10n
run: flutter gen-l10n
- name: test
run: |
echo "${{ secrets.GOOGLE_TEST_SERVICE_ACCOUNT_JSON }}" | base64 -d >> ./test/auto-test-service-account.json
flutter test
- name: prepare gradle cache key
# we explicitly use the same cache key for restoring and saving the cache because
# it seems that the flutter build modifies gradle files and if we generate the key
# from hash after the build (on cache save), we get a hash value whcih is different
# from the value we get initially (on cache restore)
run: echo "GRADLE_CACHE_KEY=gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}" >> $GITHUB_ENV
- name: restore gradle cache
uses: actions/cache/restore@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ env.GRADLE_CACHE_KEY }}
- name: release paperwork
run: |
./gradlew release-paperwork
git push
- name: build apk
run: flutter build apk --release
- name: build app bundle
run: flutter build appbundle
- name: save gradle cache
uses: actions/cache/save@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ env.GRADLE_CACHE_KEY }}
- name: upload apk
uses: actions/upload-artifact@v4
with:
name: apk
path: build/app/outputs/flutter-apk/app-release.apk
- name: upload aab
uses: actions/upload-artifact@v4
with:
name: aab
path: build/app/outputs/bundle/release/app-release.aab
# - name: build ios
# run: flutter build ios --no-codesign