diff --git a/CHANGELOG.md b/CHANGELOG.md index b30b27c..be256ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [1.0.4] - 2026-01-03 + +### Added +- `health.json` generated at build time with app version info +- `health.html` now displays version, title, and status from health.json + ## [1.0.3] - 2026-01-03 ### Fixed diff --git a/Dockerfile b/Dockerfile index f6de2b9..989aa18 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,6 +15,9 @@ COPY . . # Generate code with build_runner RUN dart run build_runner build --delete-conflicting-outputs +# Generate health.json with version info +RUN dart run tool/generate_health_json.dart + # Build for web release with production configuration # These URLs enable authentication (requiresAuth = true when URL contains schweitz.net) RUN flutter build web --release \ diff --git a/pubspec.yaml b/pubspec.yaml index d04896b..56d92ae 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 1.0.3+1 +version: 1.0.4+1 environment: sdk: ^3.10.4 diff --git a/tool/generate_health_json.dart b/tool/generate_health_json.dart new file mode 100644 index 0000000..25b2333 --- /dev/null +++ b/tool/generate_health_json.dart @@ -0,0 +1,49 @@ +#!/usr/bin/env dart +// Generates web/health.json from pubspec.yaml +// Run: dart run tool/generate_health_json.dart + +import 'dart:convert'; +import 'dart:io'; + +import 'package:yaml/yaml.dart'; + +void main() { + final pubspecFile = File('pubspec.yaml'); + if (!pubspecFile.existsSync()) { + stderr.writeln('Error: pubspec.yaml not found'); + exit(1); + } + + final pubspecContent = pubspecFile.readAsStringSync(); + final pubspec = loadYaml(pubspecContent) as YamlMap; + + final name = pubspec['name'] as String; + final description = pubspec['description'] as String? ?? ''; + final versionString = pubspec['version'] as String; + + // Parse version: "1.0.3+1" -> version="1.0.3", buildNumber=1 + final versionParts = versionString.split('+'); + final version = versionParts[0]; + final buildNumber = versionParts.length > 1 ? int.parse(versionParts[1]) : 0; + + final health = { + 'status': 'healthy', + 'name': name, + 'title': description, + 'version': version, + 'buildNumber': buildNumber, + 'fullVersion': '$version+$buildNumber', + }; + + final webDir = Directory('web'); + if (!webDir.existsSync()) { + webDir.createSync(recursive: true); + } + + final healthFile = File('web/health.json'); + healthFile.writeAsStringSync( + const JsonEncoder.withIndent(' ').convert(health), + ); + + print('Generated web/health.json with version $version+$buildNumber'); +} diff --git a/web/health.html b/web/health.html index 7cdedf6..4fb02f3 100644 --- a/web/health.html +++ b/web/health.html @@ -1,7 +1,30 @@
-