diff --git a/Dockerfile b/Dockerfile index 39f74fd..c5615b1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,10 +11,14 @@ FROM ghcr.io/cirruslabs/flutter:3.44.0 AS build # docker build --build-arg API_BASE_URL=https://api.mymuseum.be -t ... . ARG API_BASE_URL=http://localhost:5000 +# Empreinte du commit, affichee sur l'ecran de login (voir kGitSha). +# docker build --build-arg GIT_SHA=$(git rev-parse --short HEAD) ... +ARG GIT_SHA=dev + WORKDIR /app COPY . . RUN flutter pub get -RUN flutter build web --release --dart-define=API_BASE_URL=$API_BASE_URL +RUN flutter build web --release --dart-define=API_BASE_URL=$API_BASE_URL --dart-define=GIT_SHA=$GIT_SHA FROM nginx:1.27-alpine COPY nginx.conf /etc/nginx/conf.d/default.conf diff --git a/lib/Screens/login_screen.dart b/lib/Screens/login_screen.dart index d11215d..ad39466 100644 --- a/lib/Screens/login_screen.dart +++ b/lib/Screens/login_screen.dart @@ -42,6 +42,7 @@ class _LoginScreenState extends State { String? instanceId; String? pinCode; Storage localStorage = window.localStorage; + late final Future appVersion = getAppVersion(); void authenticateTRY(AppContext appContext, bool fromClick) async { clientAPI = Client(this.host!); @@ -290,7 +291,7 @@ class _LoginScreenState extends State { textAlign: TextAlign.center, ), FutureBuilder( - future: getAppVersion(), + future: appVersion, builder: (context, AsyncSnapshot snapshot) { if (snapshot.connectionState == ConnectionState.done && snapshot.data != null) { @@ -389,6 +390,6 @@ class _LoginScreenState extends State { Future getAppVersion() async { PackageInfo packageInfo = await PackageInfo.fromPlatform(); - return packageInfo.version; + return 'v${packageInfo.version} \u00b7 $kGitSha'; } } diff --git a/lib/constants.dart b/lib/constants.dart index 20dfcb8..dc4bc38 100644 --- a/lib/constants.dart +++ b/lib/constants.dart @@ -23,6 +23,13 @@ const kSuccess = Color(0xFF8bc34a); const kApiBaseUrl = String.fromEnvironment('API_BASE_URL', defaultValue: 'http://localhost:5000'); +// Empreinte du build, injectee elle aussi au build : +// --dart-define=GIT_SHA=$(git rev-parse --short HEAD) +// Elle est affichee sous le titre de l'ecran de login et sert a relier un +// bundle deploye au commit exact qui l'a produit : le numero de version du +// pubspec ne suffisait pas, il ne bougeait pas d'un deploiement a l'autre. +const kGitSha = String.fromEnvironment('GIT_SHA', defaultValue: 'dev'); + // Responsive const kBreakpointMobile = 850.0; diff --git a/pubspec.yaml b/pubspec.yaml index 0d4c32d..a044ba8 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 3.0.0+10 +version: 3.1.3+11 environment: sdk: ">=3.1.0 <4.0.0" diff --git a/web/index.html b/web/index.html index b36c14f..f57bb26 100644 --- a/web/index.html +++ b/web/index.html @@ -14,6 +14,7 @@ + @@ -112,9 +113,6 @@ loadMainDartJs(); } -