Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 0 additions & 83 deletions .github/workflows/android-release.yml

This file was deleted.

119 changes: 0 additions & 119 deletions .github/workflows/ios-release.yml

This file was deleted.

151 changes: 151 additions & 0 deletions .github/workflows/staging-distribute.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
name: Staging Distribution (Android + iOS)

on:
workflow_dispatch:
inputs:
platforms:
description: 'Platforms to distribute'
required: true
default: 'both'
type: choice
options:
- android
- ios
- both
release_notes:
description: 'Release notes'
required: false
type: string

env:
FLUTTER_VERSION: "3.38.9"
FLUTTER_CHANNEL: "stable"
XCODE_VERSION: "26"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Xcode version '26' is invalid. Current stable major versions are 15 or 16. Using an incorrect version will cause the macos-latest runner to fail when locating the Xcode installation.

Suggested change
XCODE_VERSION: "26"
XCODE_VERSION: "16"

JAVA_VERSION: "17"
RUBY_VERSION: "3.2"

jobs:
android:
name: Android (Staging → Firebase)
runs-on: ubuntu-latest
if: contains(github.event.inputs.platforms, 'android') || github.event.inputs.platforms == 'both'

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: ${{ env.JAVA_VERSION }}

- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: ${{ env.FLUTTER_CHANNEL }}
cache: true

- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ env.RUBY_VERSION }}
bundler-cache: true
working-directory: android/fastlane

- name: Install Fastlane gems
working-directory: android/fastlane
run: bundle install

- name: Setup Service Accounts
env:
GOOGLE_SERVICES_ACCOUNT_BASE64: ${{ secrets.GOOGLE_SERVICES_ACCOUNT_BASE64 }}
CREDENTIAL_FILE_CONTENT: ${{ secrets.CREDENTIAL_FILE_CONTENT }}
run: |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Writing sensitive credentials to the filesystem should be followed by a cleanup step, or better yet, passed via environment variables directly if the CLI supports it. If files are necessary, ensure they are not uploaded as artifacts or left in a shared environment.

Suggested change
run: |
run: |
printf '%s' "$GOOGLE_SERVICES_ACCOUNT_BASE64" | base64 --decode > google_service_account.json
printf '%s' "$CREDENTIAL_FILE_CONTENT" > service_credentials_content.json
# Add to .gitignore dynamically or ensure cleanup
echo "google_service_account.json" >> .gitignore

printf '%s' "$GOOGLE_SERVICES_ACCOUNT_BASE64" | base64 --decode > google_service_account.json
printf '%s' "$CREDENTIAL_FILE_CONTENT" > service_credentials_content.json

- name: Setup Android signing keystore
run: |
printf '%s' "${{ secrets.ANDROID_KEYSTORE_FILE_BASE64 }}" | base64 --decode > android/key.jks

- name: Setup Android key.properties
run: |
cat <<EOF > android/key.properties
storePassword=${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
keyPassword=${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
keyAlias=release
storeFile=../key.jks
EOF

- name: Distribute to Firebase App Distribution
working-directory: android/fastlane
run: bundle exec fastlane release_play_store_using_firebase release_notes:"${{ github.event.inputs.release_notes }}"
env:
APP_PACKAGE_NAME: ${{ vars.APP_PACKAGE_NAME }}
FIREBASE_APP_ID: ${{ secrets.FIREBASE_APP_ID }}

ios:
name: iOS (Staging → TestFlight)
runs-on: macos-latest
if: contains(github.event.inputs.platforms, 'ios') || github.event.inputs.platforms == 'both'

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{ env.XCODE_VERSION }}

- name: Restore DerivedData cache
uses: actions/cache/restore@v4
id: cache-deriveddata
with:
path: DerivedData
key: deriveddata-${{ github.run_id }}
restore-keys: |
deriveddata-

- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: ${{ env.FLUTTER_CHANNEL }}
cache: true

- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ env.RUBY_VERSION }}
bundler-cache: true
working-directory: ios/fastlane

- name: Install Fastlane gems
working-directory: ios/fastlane
run: bundle install

- name: Setup SSH Key
uses: webfactory/ssh-agent@v0.9.0
with:
ssh-private-key: ${{ secrets.MATCH_DEPLOY_KEY }}

- name: Setup Service Accounts
env:
CREDENTIAL_FILE_CONTENT: ${{ secrets.CREDENTIAL_FILE_CONTENT }}
run: |
cat <<< "$CREDENTIAL_FILE_CONTENT" > service_credentials_content.json

- name: Generate code
run: flutter pub run build_runner build --delete-conflicting-outputs

- name: Distribute to TestFlight (Staging)
working-directory: ios/fastlane
run: bundle exec fastlane release_testflight_staging
env:
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
ASC_KEY_ID: ${{ secrets.ASC_KEY_ID }}
ASC_ISSUER_ID: ${{ secrets.ASC_ISSUER_ID }}
ASC_KEY_P8_BASE64: ${{ secrets.ASC_KEY_P8_BASE64 }}
4 changes: 1 addition & 3 deletions lib/data/database/app_database.dart
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,7 @@ class AppDatabase extends _$AppDatabase with SynchronizerDb {
await m.createAll();
},
onUpgrade: (Migrator m, int from, int to) async {
if (from < 4) {
await _schemaUpgrade(m, from, 4);
}
await _schemaUpgrade(m, from, to);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While refactoring to use dynamic to version is cleaner, ensure that _schemaUpgrade logic is exhaustive and handles every version jump between from and to. If it only contains logic up to version 4, jumping to version 5 might fail silently or corrupt data.

Suggested change
await _schemaUpgrade(m, from, to);
if (from < to) {
await _schemaUpgrade(m, from, to);
}

},
);
}
Expand Down
10 changes: 5 additions & 5 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,10 @@ packages:
dependency: transitive
description:
name: characters
sha256: faf38497bda5ead2a8c7615f4f7939df04333478bf32e4173fcb06d428b5716b
sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803
url: "https://pub.dev"
source: hosted
version: "1.4.1"
version: "1.4.0"
charcode:
dependency: transitive
description:
Expand Down Expand Up @@ -1276,10 +1276,10 @@ packages:
dependency: transitive
description:
name: material_color_utilities
sha256: "9c337007e82b1889149c82ed242ed1cb24a66044e30979c44912381e9be4c48b"
sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec
url: "https://pub.dev"
source: hosted
version: "0.13.0"
version: "0.11.1"
meta:
dependency: transitive
description:
Expand Down Expand Up @@ -2150,5 +2150,5 @@ packages:
source: hosted
version: "3.1.3"
sdks:
dart: ">=3.9.0-0 <4.0.0"
dart: ">=3.8.0 <4.0.0"
flutter: ">=3.32.0"
Loading