Skip to content

Commit c65d68b

Browse files
authored
Fix pipeline (#91)
* fix migration * auto update version * update version in qa * fix indentation * use path file * add pubspec read step * update android-version-code-update action to 2.1.0
1 parent 144612d commit c65d68b

File tree

3 files changed

+88
-6
lines changed

3 files changed

+88
-6
lines changed

.github/workflows/qa.yaml

+31-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ jobs:
2121
uses: actions/checkout@v4
2222
with:
2323
fetch-depth: 0
24+
25+
- name: Read YAML Data
26+
uses: altive/pubspec-metadata@v1
27+
id: pubspec
2428

2529
- name: Setup ruby
2630
uses: ruby/setup-ruby@v1
@@ -58,6 +62,10 @@ jobs:
5862
flutter pub add intl_utils
5963
flutter pub run intl_utils:generate
6064
flutter pub run build_runner build
65+
66+
- name: Create Google Play Config file
67+
id: createServiceAccount
68+
run: echo '${{ secrets.PLAY_STORE_KEY }}' > android/api-play-store-key.json
6169

6270
- name: Create Firebase Configuration Files forn Native / Flutter
6371
env:
@@ -94,10 +102,32 @@ jobs:
94102
echo "storePassword=$KEYSTORE_STORE_PASSWORD" >> android/key.properties
95103
echo "keyPassword=$KEYSTORE_KEY_PASSWORD" >> android/key.properties
96104
105+
- name: Play Store Build Number
106+
id: versioning
107+
uses: lukasa1993/[email protected]
108+
with:
109+
serviceAccountJson: android/api-play-store-key.json
110+
packageName: com.dartz.amiibo_network
111+
112+
- name: 'Get next version'
113+
id: semvers
114+
uses: "WyriHaximus/github-action-next-semvers@v1"
115+
with:
116+
version: ${{ steps.pubspec.outputs.version-number }}
117+
118+
- name: Set new version number
119+
id: update_version_number
120+
run: |
121+
N_VERSION_NUMBER=${{ steps.semvers.outputs.patch }}
122+
echo "next_version_number=$N_VERSION_NUMBER" >> $GITHUB_ENV
123+
echo "version=$N_VERSION_NUMBER+${{ steps.versioning.outputs.next_version }}" >> $GITHUB_ENV
124+
97125
- name: Build release version for testing purpose
98126
env:
99127
AMAZON_TAG: ${{ secrets.AMAZON_TAG }}
100-
run: flutter build apk --split-per-abi --no-pub --verbose --release --dart-define=amazon_tag=$AMAZON_TAG
128+
build_number: ${{ steps.versioning.outputs.next_version }}
129+
version_number: ${{ env.next_version_number }}
130+
run: flutter build apk --build-number=$build_number --build-name=$version_number --split-per-abi --no-pub --verbose --release --dart-define=amazon_tag=$AMAZON_TAG
101131

102132
- name: Upload APK
103133
uses: actions/upload-artifact@v4

.github/workflows/release.yaml

+55-5
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ on:
66
- master
77
tags:
88
- 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
919

1020
env:
1121
java_version: '17'
@@ -24,7 +34,7 @@ jobs:
2434
fetch-depth: 0
2535

2636
- name: Read YAML Data
27-
uses: RCSandberg/dart-read-package-semantic-version-action@v2
37+
uses: altive/pubspec-metadata@v1
2838
id: pubspec
2939

3040
- name: Setup ruby
@@ -102,13 +112,41 @@ jobs:
102112
echo Firebase .dart file
103113
echo "$FIREBASE_OPTIONS_DART" > FIREBASE_OPTIONS_DART.dart.b64
104114
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+
106142
- name: Build apk and appbundle
107143
env:
108144
AMAZON_TAG: ${{ secrets.AMAZON_TAG }}
145+
build_number: ${{ steps.versioning.outputs.next_version }}
146+
version_number: ${{ env.next_version_number }}
109147
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
112150
113151
- name: Upload aab symbols to firebase
114152
uses: w9jds/firebase-action@8354b09806f3107c9a27e22ec444f60452608104
@@ -119,12 +157,24 @@ jobs:
119157

120158
- name: Build appbundle and upload to google play
121159
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
122172
123173
- name: Create Github Release
124174
uses: softprops/action-gh-release@v2
125175
with:
126176
token: "${{ secrets.GITHUB_TOKEN }}"
127-
tag_name: "${{ steps.pubspec.outputs.version }}"
177+
tag_name: "${{ env.version }}"
128178
draft: true
129179
prerelease: true
130180
files: build/app/outputs/flutter-apk/app-release.apk

lib/main.dart

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import 'package:amiibo_network/riverpod/provider_observer.dart';
88
import 'package:amiibo_network/riverpod/router_provider.dart';
99
import 'package:amiibo_network/service/info_package.dart';
1010
import 'package:amiibo_network/service/update_service.dart';
11+
import 'package:amiibo_network/utils/migration.dart';
1112
import 'package:firebase_core/firebase_core.dart';
1213
import 'package:firebase_crashlytics/firebase_crashlytics.dart';
1314
import 'package:firebase_remote_config/firebase_remote_config.dart';
@@ -83,6 +84,7 @@ Future<void> main() async {
8384
}
8485

8586
final preferences = await SharedPreferences.getInstance();
87+
await sharedPreferencesMigration(preferences);
8688
await updateOldTheme();
8789
final store = await newHiveDefaultCacheStore(
8890
path: cacheDir.path,

0 commit comments

Comments
 (0)