6
6
- master
7
7
tags :
8
8
- v*
9
+ workflow_dispatch :
10
+ inputs :
11
+ version_update :
12
+ type : choice
13
+ description : What version should be used
14
+ default : patch
15
+ options :
16
+ - patch
17
+ - minor
18
+ - major
9
19
10
20
env :
11
21
java_version : ' 17'
24
34
fetch-depth : 0
25
35
26
36
- name : Read YAML Data
27
- uses : RCSandberg/dart-read-package-semantic-version-action@v2
37
+ uses : altive/pubspec-metadata@v1
28
38
id : pubspec
29
39
30
40
- name : Setup ruby
@@ -102,13 +112,41 @@ jobs:
102
112
echo Firebase .dart file
103
113
echo "$FIREBASE_OPTIONS_DART" > FIREBASE_OPTIONS_DART.dart.b64
104
114
base64 -d -i FIREBASE_OPTIONS_DART.dart.b64 > lib/firebase_options.dart
105
-
115
+
116
+ - name : Play Store Build Number
117
+ id : versioning
118
+ uses :
lukasa1993/[email protected]
119
+ with :
120
+ serviceAccountJson : android/api-play-store-key.json
121
+ packageName : com.dartz.amiibo_network
122
+
123
+ - name : ' Get next version'
124
+ id : semvers
125
+ uses : " WyriHaximus/github-action-next-semvers@v1"
126
+ with :
127
+ version : ${{ steps.pubspec.outputs.version-number }}
128
+
129
+ - name : Set new version number
130
+ id : update_version_number
131
+ run : |
132
+ if [ ${{ inputs.flavor }} == "patch" ]; then
133
+ N_VERSION_NUMBER=${{ steps.semvers.outputs.patch }}
134
+ elif [ ${{ inputs.flavor }} == "minor" ]; then
135
+ N_VERSION_NUMBER=${{ steps.semvers.outputs.minor }}
136
+ else
137
+ N_VERSION_NUMBER=${{ steps.semvers.outputs.major }}
138
+ fi
139
+ echo "next_version_number=$N_VERSION_NUMBER" >> $GITHUB_ENV
140
+ echo "version=$N_VERSION_NUMBER+${{ steps.versioning.outputs.next_version }}" >> $GITHUB_ENV
141
+
106
142
- name : Build apk and appbundle
107
143
env :
108
144
AMAZON_TAG : ${{ secrets.AMAZON_TAG }}
145
+ build_number : ${{ steps.versioning.outputs.next_version }}
146
+ version_number : ${{ env.next_version_number }}
109
147
run : |
110
- flutter build apk --no-pub --release --obfuscate --split-debug-info=build/app/outputs/apk-symbols/symbols --dart-define=amazon_tag=$AMAZON_TAG
111
- flutter build appbundle --no-pub --obfuscate --split-debug-info=build/app/outputs/aab-symbols/symbols --dart-define=amazon_tag=$AMAZON_TAG
148
+ flutter build apk --build-number=$build_number --build-name=$version_number -- no-pub --release --obfuscate --split-debug-info=build/app/outputs/apk-symbols/symbols --dart-define=amazon_tag=$AMAZON_TAG
149
+ flutter build appbundle --build-number=$build_number --build-name=$version_number -- no-pub --obfuscate --split-debug-info=build/app/outputs/aab-symbols/symbols --dart-define=amazon_tag=$AMAZON_TAG
112
150
113
151
- name : Upload aab symbols to firebase
114
152
uses : w9jds/firebase-action@8354b09806f3107c9a27e22ec444f60452608104
@@ -119,12 +157,24 @@ jobs:
119
157
120
158
- name : Build appbundle and upload to google play
121
159
run : bundle exec fastlane android internal
160
+
161
+ - uses : rmeneely/update-yaml@v1
162
+ with :
163
+ infile : pubspec.yaml
164
+ varlist : ' version=${{ env.version }}'
165
+
166
+ - name : Update version in pubspec
167
+ run : |
168
+ git config --global user.name '${{ secrets.USERNAME }}'
169
+ git config --global user.email '${{ secrets.EMAIL }}'
170
+ git commit -am "[skip ci] Automated new version: ${{ env.version }}"
171
+ git push
122
172
123
173
- name : Create Github Release
124
174
uses : softprops/action-gh-release@v2
125
175
with :
126
176
token : " ${{ secrets.GITHUB_TOKEN }}"
127
- tag_name : " ${{ steps.pubspec.outputs .version }}"
177
+ tag_name : " ${{ env .version }}"
128
178
draft : true
129
179
prerelease : true
130
180
files : build/app/outputs/flutter-apk/app-release.apk
0 commit comments