-
Notifications
You must be signed in to change notification settings - Fork 18
118 lines (104 loc) · 4.03 KB
/
deploy.yaml
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
on:
push:
branches: [ master, develop ]
jobs:
bump_version:
name: "Bump pubspec version"
runs-on: ubuntu-latest
env:
APP_VERSION_PATH: "uni/app_version.txt"
PUBSPEC_PATH: "uni/pubspec.yaml"
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.NIAEFEUPBOT_PAT }}
- name: Get develop hash
if: github.ref == 'refs/heads/master'
run: |
git fetch origin develop
current_hash=$(git rev-parse origin/develop)
echo "DEVELOPHASH=$current_hash" >> $GITHUB_ENV
- name: Bump flutter patch version
if: github.ref == 'refs/heads/develop' || github.sha != env.DEVELOPHASH
run: perl -i -pe 's/^(\d+\.\d+\.)(\d+)(\+)(\d+)$/$1.($2+1).($3).($4+1)/e' ${{ env.APP_VERSION_PATH }}
- name: Bump flutter minor version
if: github.ref == 'refs/heads/master' && github.sha == env.DEVELOPHASH
run: perl -i -pe 's/^(\d+)(\.)(\d+)(\.)(\d+)(\+)(\d+)$/$1.($2).($3+1).($4).(0).($6).($7+1)/e' ${{ env.APP_VERSION_PATH }}
- name: Copy app version to pubspec
run: cat ${{ env.APP_VERSION_PATH }} | perl -i -pe 's/^(version:\s+)(\d+\.\d+\.\d+\+\d+)$/$1.(<STDIN>)/e' ${{ env.PUBSPEC_PATH }}
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "Bump app version [no ci]"
- name: Propagate master version bump to develop
if: github.ref == 'refs/heads/master'
run: git push --force-with-lease origin HEAD:develop
build:
name: "Build App Bundle"
runs-on: ubuntu-latest
needs: [bump_version]
env:
PROPERTIES_PATH: "android/key.properties"
JAVA_VERSION: "11.x"
FLUTTER_VERSION: "3.10.6"
defaults:
run:
working-directory: ./uni
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: ${{env.JAVA_VERSION}}
distribution: 'zulu'
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
- name: Download Android keystore
run: echo "${{ secrets.ANDROID_KEYSTORE_BASE64 }}" | base64 --decode > /tmp/key.jks
- name: Create key.properties
run: |
rm -f -- ${{env.PROPERTIES_PATH}}
touch ${{env.PROPERTIES_PATH}}
echo "storeFile=/tmp/key.jks" >> ${{env.PROPERTIES_PATH}}
echo "storePassword=${{ secrets.ANDROID_KEYSTORE_PASSWORD }}" >> ${{env.PROPERTIES_PATH}}
echo "keyPassword=${{ secrets.ANDROID_KEY_PASSWORD }}" >> ${{env.PROPERTIES_PATH}}
echo "keyAlias=${{ secrets.ANDROID_KEY_ALIAS }}" >> ${{env.PROPERTIES_PATH}}
- name: Build Android App Bundle
run: |
flutter pub get
flutter build appbundle
- name: Upload App Bundle
uses: actions/upload-artifact@v3
with:
name: appbundle
if-no-files-found: error
path: uni/build/app/outputs/bundle/release/app-release.aab
deploy_play_store:
name: "Deploy to Google Play Store"
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/checkout@v3
- name: Get App Bundle
uses: actions/download-artifact@v3
with:
name: appbundle
- name: Release app to beta track
if: github.ref == 'refs/heads/develop'
uses: r0adkll/upload-google-play@v1
with:
serviceAccountJsonPlainText: ${{ secrets.GOOGLE_SERVICE_ACCOUNT_JSON }}
packageName: ${{ secrets.ANDROID_PACKAGE_NAME }}
releaseFiles: app-release.aab
whatsNewDirectory: whatsnew
track: beta
status: completed
- name: Release app to production track
if: github.ref == 'refs/heads/master'
uses: r0adkll/upload-google-play@v1
with:
serviceAccountJsonPlainText: ${{ secrets.GOOGLE_SERVICE_ACCOUNT_JSON }}
packageName: ${{ secrets.ANDROID_PACKAGE_NAME }}
releaseFiles: app-release.aab
whatsNewDirectory: whatsnew
track: production
status: completed