Skip to content

Commit

Permalink
Fix pipeline (#91)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
EdwynZN authored Dec 21, 2024
1 parent 144612d commit c65d68b
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 6 deletions.
32 changes: 31 additions & 1 deletion .github/workflows/qa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Read YAML Data
uses: altive/pubspec-metadata@v1
id: pubspec

- name: Setup ruby
uses: ruby/setup-ruby@v1
Expand Down Expand Up @@ -58,6 +62,10 @@ jobs:
flutter pub add intl_utils
flutter pub run intl_utils:generate
flutter pub run build_runner build
- name: Create Google Play Config file
id: createServiceAccount
run: echo '${{ secrets.PLAY_STORE_KEY }}' > android/api-play-store-key.json

- name: Create Firebase Configuration Files forn Native / Flutter
env:
Expand Down Expand Up @@ -94,10 +102,32 @@ jobs:
echo "storePassword=$KEYSTORE_STORE_PASSWORD" >> android/key.properties
echo "keyPassword=$KEYSTORE_KEY_PASSWORD" >> android/key.properties
- name: Play Store Build Number
id: versioning
uses: lukasa1993/[email protected]
with:
serviceAccountJson: android/api-play-store-key.json
packageName: com.dartz.amiibo_network

- name: 'Get next version'
id: semvers
uses: "WyriHaximus/github-action-next-semvers@v1"
with:
version: ${{ steps.pubspec.outputs.version-number }}

- name: Set new version number
id: update_version_number
run: |
N_VERSION_NUMBER=${{ steps.semvers.outputs.patch }}
echo "next_version_number=$N_VERSION_NUMBER" >> $GITHUB_ENV
echo "version=$N_VERSION_NUMBER+${{ steps.versioning.outputs.next_version }}" >> $GITHUB_ENV
- name: Build release version for testing purpose
env:
AMAZON_TAG: ${{ secrets.AMAZON_TAG }}
run: flutter build apk --split-per-abi --no-pub --verbose --release --dart-define=amazon_tag=$AMAZON_TAG
build_number: ${{ steps.versioning.outputs.next_version }}
version_number: ${{ env.next_version_number }}
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

- name: Upload APK
uses: actions/upload-artifact@v4
Expand Down
60 changes: 55 additions & 5 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ on:
- master
tags:
- v*
workflow_dispatch:
inputs:
version_update:
type: choice
description: What version should be used
default: patch
options:
- patch
- minor
- major

env:
java_version: '17'
Expand All @@ -24,7 +34,7 @@ jobs:
fetch-depth: 0

- name: Read YAML Data
uses: RCSandberg/dart-read-package-semantic-version-action@v2
uses: altive/pubspec-metadata@v1
id: pubspec

- name: Setup ruby
Expand Down Expand Up @@ -102,13 +112,41 @@ jobs:
echo Firebase .dart file
echo "$FIREBASE_OPTIONS_DART" > FIREBASE_OPTIONS_DART.dart.b64
base64 -d -i FIREBASE_OPTIONS_DART.dart.b64 > lib/firebase_options.dart
- name: Play Store Build Number
id: versioning
uses: lukasa1993/[email protected]
with:
serviceAccountJson: android/api-play-store-key.json
packageName: com.dartz.amiibo_network

- name: 'Get next version'
id: semvers
uses: "WyriHaximus/github-action-next-semvers@v1"
with:
version: ${{ steps.pubspec.outputs.version-number }}

- name: Set new version number
id: update_version_number
run: |
if [ ${{ inputs.flavor }} == "patch" ]; then
N_VERSION_NUMBER=${{ steps.semvers.outputs.patch }}
elif [ ${{ inputs.flavor }} == "minor" ]; then
N_VERSION_NUMBER=${{ steps.semvers.outputs.minor }}
else
N_VERSION_NUMBER=${{ steps.semvers.outputs.major }}
fi
echo "next_version_number=$N_VERSION_NUMBER" >> $GITHUB_ENV
echo "version=$N_VERSION_NUMBER+${{ steps.versioning.outputs.next_version }}" >> $GITHUB_ENV
- name: Build apk and appbundle
env:
AMAZON_TAG: ${{ secrets.AMAZON_TAG }}
build_number: ${{ steps.versioning.outputs.next_version }}
version_number: ${{ env.next_version_number }}
run: |
flutter build apk --no-pub --release --obfuscate --split-debug-info=build/app/outputs/apk-symbols/symbols --dart-define=amazon_tag=$AMAZON_TAG
flutter build appbundle --no-pub --obfuscate --split-debug-info=build/app/outputs/aab-symbols/symbols --dart-define=amazon_tag=$AMAZON_TAG
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
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
- name: Upload aab symbols to firebase
uses: w9jds/firebase-action@8354b09806f3107c9a27e22ec444f60452608104
Expand All @@ -119,12 +157,24 @@ jobs:

- name: Build appbundle and upload to google play
run: bundle exec fastlane android internal

- uses: rmeneely/update-yaml@v1
with:
infile: pubspec.yaml
varlist: 'version=${{ env.version }}'

- name: Update version in pubspec
run: |
git config --global user.name '${{ secrets.USERNAME }}'
git config --global user.email '${{ secrets.EMAIL }}'
git commit -am "[skip ci] Automated new version: ${{ env.version }}"
git push
- name: Create Github Release
uses: softprops/action-gh-release@v2
with:
token: "${{ secrets.GITHUB_TOKEN }}"
tag_name: "${{ steps.pubspec.outputs.version }}"
tag_name: "${{ env.version }}"
draft: true
prerelease: true
files: build/app/outputs/flutter-apk/app-release.apk
2 changes: 2 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:amiibo_network/riverpod/provider_observer.dart';
import 'package:amiibo_network/riverpod/router_provider.dart';
import 'package:amiibo_network/service/info_package.dart';
import 'package:amiibo_network/service/update_service.dart';
import 'package:amiibo_network/utils/migration.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_crashlytics/firebase_crashlytics.dart';
import 'package:firebase_remote_config/firebase_remote_config.dart';
Expand Down Expand Up @@ -83,6 +84,7 @@ Future<void> main() async {
}

final preferences = await SharedPreferences.getInstance();
await sharedPreferencesMigration(preferences);
await updateOldTheme();
final store = await newHiveDefaultCacheStore(
path: cacheDir.path,
Expand Down

0 comments on commit c65d68b

Please sign in to comment.