Add new build system for android releases

This commit is contained in:
Roland Geider
2021-11-08 15:25:06 +01:00
parent e5bd9e901f
commit 520b0b1460
6 changed files with 142 additions and 27 deletions

View File

@@ -0,0 +1,90 @@
name: Google Play release 2
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
jobs:
deploy_android:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Java
uses: actions/setup-java@v1
with:
java-version: 11.x
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3'
- name: Setup Flutter
uses: subosito/flutter-action@v1
with:
channel: 'stable'
flutter-version: '2.5.x'
- name: Decrypt config files
run: |
cd ./android/fastlane/envfiles
chmod +x ./decrypt_secrets.sh
./decrypt_secrets.sh
env:
DECRYPTKEY_PLAYSTORE: ${{ secrets.DECRYPTKEY_PLAYSTORE }}
DECRYPTKEY_PLAYSTORE_SIGNING_KEY: ${{ secrets.DECRYPTKEY_PLAYSTORE_SIGNING_KEY }}
DECRYPTKEY_PROPERTIES: ${{ secrets.DECRYPTKEY_PROPERTIES }}
- name: Flutter info
run: |
dart --version
flutter --version
- name: Install Flutter dependencies
run: flutter pub get
- name: Extract version information
id: get_version
run: |
echo ::set-output name=VERSION_V::$(echo $GITHUB_REF | cut -d / -f 3)
echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3 | cut -c 2-)
echo ::set-output name=BUILD::$(flutter pub run cider version | cut -d '+' -f 2)
# Note: the original tag that triggered the workflow is in the form vX.Y.Z
# but the pubspec.yaml is committed in the commit after that one.
# Since we need the tag to point to the correct commit for other workflows
# such as f-droid we need a way to correct it. Only moving the tag
# would not work, as it would trigger this workflow again. So as
# a workaround, we use the v-tag to trigger this workflow, add a new
# one without the v and push it.
- name: Bump version
run: |
flutter pub run cider version ${{ steps.get_version.outputs.VERSION }}+${{ steps.get_version.outputs.BUILD }}
flutter pub run cider bump build
git config user.name Github-actions
git config user.email github-actions@github.com
git add .
git commit -m "Bump version to $( flutter pub run cider version )"
git tag ${{ steps.get_version.outputs.VERSION }}
git push origin HEAD:master --tags
git push origin --delete ${{ steps.get_version.outputs.VERSION_V }}
- name: Build AAB
run: flutter build appbundle --release
env:
WGER_API_KEY: ${{ secrets.WGER_API_KEY }}
- name: Upload build to Play Store
uses: maierj/fastlane-action@v2
with:
lane: production
subdirectory: android
- name: Make Github release
uses: softprops/action-gh-release@v1
with:
files: build/app/outputs/bundle/release/app-release.aab
tag_name: ${{ steps.get_version.outputs.VERSION }}

View File

@@ -25,30 +25,6 @@ end
platform :android do
desc "Sets the version name and code in pubspec.yaml"
lane :setVersion do
begin
old_version_code = google_play_track_version_codes(
package_name: "de.wger.flutter",
track: "production",
json_key: "./fastlane/envfiles/playstore.json",
)
puts "old_version_code: " + old_version_code.to_s
new_version_code = old_version_code.last().to_i + 1
puts "new_version_code: " + new_version_code.to_s
new_version_name = get_version_number_from_git_branch(pattern: 'release/#')
puts new_version_name.to_s
flutter_set_version(
path_to_yaml: "../pubspec.yaml",
version_name: new_version_name.to_s,
version_code: new_version_code.to_s,
)
end
end
desc "Upload app to production"
lane :production do
begin

View File

@@ -3,4 +3,3 @@
# Ensure this file is checked in to source control!
gem 'fastlane-plugin-versioning'
gem 'fastlane-plugin-flutter_dart_version_manager'

0
android/fastlane/envfiles/decrypt_secrets.sh Normal file → Executable file
View File

View File

@@ -127,6 +127,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.1+1"
change:
dependency: transitive
description:
name: change
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.0"
characters:
dependency: transitive
description:
@@ -176,6 +183,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
cider:
dependency: "direct dev"
description:
name: cider
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.0"
cli_util:
dependency: transitive
description:
@@ -504,6 +518,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "4.1.4"
klizma:
dependency: transitive
description:
name: klizma
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.0"
lints:
dependency: transitive
description:
@@ -518,6 +539,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.2"
markdown:
dependency: transitive
description:
name: markdown
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.0"
marker:
dependency: transitive
description:
name: marker
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.2"
matcher:
dependency: transitive
description:
@@ -693,6 +728,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1+1"
rfc_6901:
dependency: transitive
description:
name: rfc_6901
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.0"
rive:
dependency: "direct main"
description:
@@ -908,6 +950,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version_manipulation:
dependency: transitive
description:
name: version_manipulation
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.0"
video_player:
dependency: transitive
description:

View File

@@ -20,7 +20,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# github action, the current versions are ignored.
# - the version number is taken from the git branch release/x.y.z
# - the build number is computed by reading the last one from the play store and increased by one
version: 0.2.0+11
version: 1.3.0+23
environment:
sdk: '>=2.12.0 <3.0.0'
@@ -36,6 +36,7 @@ dependencies:
charts_flutter: ^0.12.0
collection: ^1.15.0-nullsafety.4
cupertino_icons: ^1.0.0
equatable: ^2.0.3
flutter_calendar_carousel: ^2.0.3
flutter_html: ^2.1.2
flutter_typeahead: ^3.2.0
@@ -51,7 +52,6 @@ dependencies:
shared_preferences: ^2.0.7
table_calendar: ^3.0.2
url_launcher: ^6.0.10
equatable: ^2.0.3
dev_dependencies:
flutter_test:
@@ -64,6 +64,7 @@ dev_dependencies:
mockito: ^5.0.15
network_image_mock: ^2.0.1
flutter_lints: ^1.0.4
cider: ^0.1.0
flutter_icons:
android: true