diff --git a/mobile/README.md b/mobile/README.md index 95f2897fb..b7a843467 100644 --- a/mobile/README.md +++ b/mobile/README.md @@ -172,6 +172,8 @@ flutter build apk --release flutter build appbundle --release ``` +Android release metadata comes from `pubspec.yaml` (`version: +`). Keep the numeric build code increasing for every release so Android can install upgrades over older APKs. + ### iOS ```bash diff --git a/mobile/pubspec.yaml b/mobile/pubspec.yaml index d69aac7fa..1034a6891 100644 --- a/mobile/pubspec.yaml +++ b/mobile/pubspec.yaml @@ -1,7 +1,7 @@ name: sure_mobile description: A mobile app for Sure personal finance management publish_to: 'none' -version: 0.6.9+9 +version: 0.6.9+12 environment: sdk: '>=3.0.0 <4.0.0' diff --git a/mobile/test/versioning_test.dart b/mobile/test/versioning_test.dart new file mode 100644 index 000000000..023a0ab60 --- /dev/null +++ b/mobile/test/versioning_test.dart @@ -0,0 +1,25 @@ +import 'dart:io'; + +import 'package:flutter_test/flutter_test.dart'; + +void main() { + test('Android versionCode stays above the last published release', () { + final pubspec = File('pubspec.yaml').readAsStringSync(); + final versionMatch = RegExp(r'^version:\s*([^\s]+)$', multiLine: true).firstMatch(pubspec); + + expect(versionMatch, isNotNull); + + final version = versionMatch!.group(1)!; + final versionParts = version.split('+'); + + expect(versionParts.length, 2); + + final versionCode = int.parse(versionParts[1]); + + expect( + versionCode, + greaterThan(11), + reason: 'Android upgrades require monotonically increasing versionCode values; v0.6.8 shipped with versionCode 11.', + ); + }); +}