Version of app integration
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
class AppVersion {
|
||||
const AppVersion._();
|
||||
|
||||
static const String version = String.fromEnvironment(
|
||||
'APP_VERSION',
|
||||
defaultValue: '1.1.0',
|
||||
);
|
||||
|
||||
static const String buildNumber = String.fromEnvironment(
|
||||
'APP_BUILD_NUMBER',
|
||||
defaultValue: '2',
|
||||
);
|
||||
|
||||
static const String display = 'Version $version (Build $buildNumber)';
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import '../config/app_version.dart';
|
||||
import '../controller/login_controller.dart';
|
||||
import '../widgets/my_login_widget.dart';
|
||||
|
||||
@@ -14,6 +15,23 @@ class LoginPage extends GetView<LoginController> {
|
||||
var displayHeight = MediaQuery.of(context).size.height;
|
||||
return SafeArea(
|
||||
child: Scaffold(
|
||||
bottomNavigationBar: Container(
|
||||
alignment: Alignment.center,
|
||||
color: Colors.blue.shade100,
|
||||
height: 36,
|
||||
child: Tooltip(
|
||||
message: 'SemVer: ${AppVersion.version}+${AppVersion.buildNumber}',
|
||||
child: Text(
|
||||
AppVersion.display,
|
||||
style: TextStyle(
|
||||
color: Colors.blueGrey.shade700,
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w600,
|
||||
letterSpacing: 0.3,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
body: Container(
|
||||
height: displayHeight,
|
||||
width: displayWidth,
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ description: "A new Flutter project."
|
||||
|
||||
publish_to: "none"
|
||||
|
||||
version: 1.0.0+1
|
||||
version: 1.1.0+2
|
||||
|
||||
environment:
|
||||
sdk: ^3.10.7
|
||||
|
||||
+28
-4
@@ -13,12 +13,33 @@ SERVER_PATH="/root/webserver"
|
||||
echo "🚀 Starting Flutter Web App Update..."
|
||||
echo "================================================"
|
||||
|
||||
# Step 1: Build Flutter Web
|
||||
echo "📦 Building Flutter web release..."
|
||||
flutter build web --release --no-wasm-dry-run
|
||||
# Step 1: Buildnummer nach Flutter-/SemVer-Konvention erhoehen
|
||||
# Die SemVer-Version (MAJOR.MINOR.PATCH) wird bei fachlichen Releases manuell
|
||||
# in pubspec.yaml gepflegt. Jeder Deployment-Build erhaelt eine neue BUILD-Nr.
|
||||
CURRENT_APP_VERSION=$(sed -n 's/^version:[[:space:]]*//p' pubspec.yaml | head -n 1)
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
if [[ ! "$CURRENT_APP_VERSION" =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)\+([0-9]+)$ ]]; then
|
||||
echo "❌ Invalid version in pubspec.yaml: $CURRENT_APP_VERSION"
|
||||
echo " Expected format: MAJOR.MINOR.PATCH+BUILD (for example 1.1.0+2)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SEMVER="${CURRENT_APP_VERSION%%+*}"
|
||||
CURRENT_BUILD_NUMBER="${CURRENT_APP_VERSION##*+}"
|
||||
NEXT_BUILD_NUMBER=$((10#$CURRENT_BUILD_NUMBER + 1))
|
||||
NEXT_APP_VERSION="$SEMVER+$NEXT_BUILD_NUMBER"
|
||||
|
||||
sed -i "s/^version:.*/version: $NEXT_APP_VERSION/" pubspec.yaml
|
||||
|
||||
echo "🏷️ Version: $CURRENT_APP_VERSION -> $NEXT_APP_VERSION"
|
||||
echo "📦 Building Flutter web release..."
|
||||
|
||||
if ! flutter build web --release --no-wasm-dry-run \
|
||||
--dart-define="APP_VERSION=$SEMVER" \
|
||||
--dart-define="APP_BUILD_NUMBER=$NEXT_BUILD_NUMBER"; then
|
||||
sed -i "s/^version:.*/version: $CURRENT_APP_VERSION/" pubspec.yaml
|
||||
echo "❌ Build failed!"
|
||||
echo " Version restored to $CURRENT_APP_VERSION"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -61,4 +82,7 @@ echo "✅ Update complete!"
|
||||
echo "================================================"
|
||||
echo "Your app should now be updated at:"
|
||||
echo " http://tank.joshihomeserver.ipv64.net"
|
||||
echo "Deployed version: $NEXT_APP_VERSION"
|
||||
echo "The login page must show: Version $SEMVER (Build $NEXT_BUILD_NUMBER)"
|
||||
echo "If another version is shown, refresh the browser with Ctrl+F5."
|
||||
echo "================================================"
|
||||
|
||||
@@ -42,6 +42,6 @@ _flutter.buildConfig = {"engineRevision":"af7e796e161ae0bb1ff0758c71a7105418bd9d
|
||||
|
||||
_flutter.loader.load({
|
||||
serviceWorkerSettings: {
|
||||
serviceWorkerVersion: "2476194018" /* Flutter's service worker is deprecated and will be removed in a future Flutter release. */
|
||||
serviceWorkerVersion: "2875783503" /* Flutter's service worker is deprecated and will be removed in a future Flutter release. */
|
||||
}
|
||||
});
|
||||
|
||||
+8286
-8283
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
||||
{"app_name":"flutter_tank_web_app","version":"1.0.0","build_number":"1","package_name":"flutter_tank_web_app"}
|
||||
{"app_name":"flutter_tank_web_app","version":"1.1.0","build_number":"2","package_name":"flutter_tank_web_app"}
|
||||
Reference in New Issue
Block a user