Skip to content

Commit 520b0b1

Browse files
committed
Add new build system for android releases
1 parent e5bd9e9 commit 520b0b1

File tree

6 files changed

+142
-27
lines changed

6 files changed

+142
-27
lines changed
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: Google Play release 2
2+
on:
3+
push:
4+
tags:
5+
- 'v[0-9]+.[0-9]+.[0-9]+'
6+
7+
jobs:
8+
deploy_android:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout code
12+
uses: actions/checkout@v2
13+
14+
- name: Setup Java
15+
uses: actions/setup-java@v1
16+
with:
17+
java-version: 11.x
18+
19+
- name: Setup Ruby
20+
uses: ruby/setup-ruby@v1
21+
with:
22+
ruby-version: '3'
23+
24+
- name: Setup Flutter
25+
uses: subosito/flutter-action@v1
26+
with:
27+
channel: 'stable'
28+
flutter-version: '2.5.x'
29+
30+
- name: Decrypt config files
31+
run: |
32+
cd ./android/fastlane/envfiles
33+
chmod +x ./decrypt_secrets.sh
34+
./decrypt_secrets.sh
35+
env:
36+
DECRYPTKEY_PLAYSTORE: ${{ secrets.DECRYPTKEY_PLAYSTORE }}
37+
DECRYPTKEY_PLAYSTORE_SIGNING_KEY: ${{ secrets.DECRYPTKEY_PLAYSTORE_SIGNING_KEY }}
38+
DECRYPTKEY_PROPERTIES: ${{ secrets.DECRYPTKEY_PROPERTIES }}
39+
40+
- name: Flutter info
41+
run: |
42+
dart --version
43+
flutter --version
44+
45+
- name: Install Flutter dependencies
46+
run: flutter pub get
47+
48+
- name: Extract version information
49+
id: get_version
50+
run: |
51+
echo ::set-output name=VERSION_V::$(echo $GITHUB_REF | cut -d / -f 3)
52+
echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3 | cut -c 2-)
53+
echo ::set-output name=BUILD::$(flutter pub run cider version | cut -d '+' -f 2)
54+
55+
# Note: the original tag that triggered the workflow is in the form vX.Y.Z
56+
# but the pubspec.yaml is committed in the commit after that one.
57+
# Since we need the tag to point to the correct commit for other workflows
58+
# such as f-droid we need a way to correct it. Only moving the tag
59+
# would not work, as it would trigger this workflow again. So as
60+
# a workaround, we use the v-tag to trigger this workflow, add a new
61+
# one without the v and push it.
62+
- name: Bump version
63+
run: |
64+
flutter pub run cider version ${{ steps.get_version.outputs.VERSION }}+${{ steps.get_version.outputs.BUILD }}
65+
flutter pub run cider bump build
66+
67+
git config user.name Github-actions
68+
git config user.email [email protected]
69+
git add .
70+
git commit -m "Bump version to $( flutter pub run cider version )"
71+
git tag ${{ steps.get_version.outputs.VERSION }}
72+
git push origin HEAD:master --tags
73+
git push origin --delete ${{ steps.get_version.outputs.VERSION_V }}
74+
75+
- name: Build AAB
76+
run: flutter build appbundle --release
77+
env:
78+
WGER_API_KEY: ${{ secrets.WGER_API_KEY }}
79+
80+
- name: Upload build to Play Store
81+
uses: maierj/fastlane-action@v2
82+
with:
83+
lane: production
84+
subdirectory: android
85+
86+
- name: Make Github release
87+
uses: softprops/action-gh-release@v1
88+
with:
89+
files: build/app/outputs/bundle/release/app-release.aab
90+
tag_name: ${{ steps.get_version.outputs.VERSION }}

android/fastlane/Fastfile

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -25,30 +25,6 @@ end
2525

2626
platform :android do
2727

28-
desc "Sets the version name and code in pubspec.yaml"
29-
lane :setVersion do
30-
begin
31-
old_version_code = google_play_track_version_codes(
32-
package_name: "de.wger.flutter",
33-
track: "production",
34-
json_key: "./fastlane/envfiles/playstore.json",
35-
)
36-
puts "old_version_code: " + old_version_code.to_s
37-
new_version_code = old_version_code.last().to_i + 1
38-
puts "new_version_code: " + new_version_code.to_s
39-
40-
new_version_name = get_version_number_from_git_branch(pattern: 'release/#')
41-
puts new_version_name.to_s
42-
43-
flutter_set_version(
44-
path_to_yaml: "../pubspec.yaml",
45-
version_name: new_version_name.to_s,
46-
version_code: new_version_code.to_s,
47-
)
48-
end
49-
end
50-
51-
5228
desc "Upload app to production"
5329
lane :production do
5430
begin

android/fastlane/Pluginfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,3 @@
33
# Ensure this file is checked in to source control!
44

55
gem 'fastlane-plugin-versioning'
6-
gem 'fastlane-plugin-flutter_dart_version_manager'

android/fastlane/envfiles/decrypt_secrets.sh

100644100755
File mode changed.

pubspec.lock

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,13 @@ packages:
127127
url: "https://pub.dartlang.org"
128128
source: hosted
129129
version: "0.2.1+1"
130+
change:
131+
dependency: transitive
132+
description:
133+
name: change
134+
url: "https://pub.dartlang.org"
135+
source: hosted
136+
version: "0.3.0"
130137
characters:
131138
dependency: transitive
132139
description:
@@ -176,6 +183,13 @@ packages:
176183
url: "https://pub.dartlang.org"
177184
source: hosted
178185
version: "1.2.0"
186+
cider:
187+
dependency: "direct dev"
188+
description:
189+
name: cider
190+
url: "https://pub.dartlang.org"
191+
source: hosted
192+
version: "0.1.0"
179193
cli_util:
180194
dependency: transitive
181195
description:
@@ -504,6 +518,13 @@ packages:
504518
url: "https://pub.dartlang.org"
505519
source: hosted
506520
version: "4.1.4"
521+
klizma:
522+
dependency: transitive
523+
description:
524+
name: klizma
525+
url: "https://pub.dartlang.org"
526+
source: hosted
527+
version: "0.2.0"
507528
lints:
508529
dependency: transitive
509530
description:
@@ -518,6 +539,20 @@ packages:
518539
url: "https://pub.dartlang.org"
519540
source: hosted
520541
version: "1.0.2"
542+
markdown:
543+
dependency: transitive
544+
description:
545+
name: markdown
546+
url: "https://pub.dartlang.org"
547+
source: hosted
548+
version: "4.0.0"
549+
marker:
550+
dependency: transitive
551+
description:
552+
name: marker
553+
url: "https://pub.dartlang.org"
554+
source: hosted
555+
version: "0.2.2"
521556
matcher:
522557
dependency: transitive
523558
description:
@@ -693,6 +728,13 @@ packages:
693728
url: "https://pub.dartlang.org"
694729
source: hosted
695730
version: "3.0.1+1"
731+
rfc_6901:
732+
dependency: transitive
733+
description:
734+
name: rfc_6901
735+
url: "https://pub.dartlang.org"
736+
source: hosted
737+
version: "0.1.0"
696738
rive:
697739
dependency: "direct main"
698740
description:
@@ -908,6 +950,13 @@ packages:
908950
url: "https://pub.dartlang.org"
909951
source: hosted
910952
version: "2.0.0"
953+
version_manipulation:
954+
dependency: transitive
955+
description:
956+
name: version_manipulation
957+
url: "https://pub.dartlang.org"
958+
source: hosted
959+
version: "0.1.0"
911960
video_player:
912961
dependency: transitive
913962
description:

pubspec.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
2020
# github action, the current versions are ignored.
2121
# - the version number is taken from the git branch release/x.y.z
2222
# - the build number is computed by reading the last one from the play store and increased by one
23-
version: 0.2.0+11
23+
version: 1.3.0+23
2424

2525
environment:
2626
sdk: '>=2.12.0 <3.0.0'
@@ -36,6 +36,7 @@ dependencies:
3636
charts_flutter: ^0.12.0
3737
collection: ^1.15.0-nullsafety.4
3838
cupertino_icons: ^1.0.0
39+
equatable: ^2.0.3
3940
flutter_calendar_carousel: ^2.0.3
4041
flutter_html: ^2.1.2
4142
flutter_typeahead: ^3.2.0
@@ -51,7 +52,6 @@ dependencies:
5152
shared_preferences: ^2.0.7
5253
table_calendar: ^3.0.2
5354
url_launcher: ^6.0.10
54-
equatable: ^2.0.3
5555

5656
dev_dependencies:
5757
flutter_test:
@@ -64,6 +64,7 @@ dev_dependencies:
6464
mockito: ^5.0.15
6565
network_image_mock: ^2.0.1
6666
flutter_lints: ^1.0.4
67+
cider: ^0.1.0
6768

6869
flutter_icons:
6970
android: true

0 commit comments

Comments
 (0)