fix(release): auto-increment patch and build number for Android and Windows releases
This commit is contained in:
1 parent
14c6193367
commit
49af400c89
4 files changed
+47
-13
No files matched your search
@@ -206,6 +206,13 @@ jobs:
|
||||
-Encoding utf8 `
|
||||
-Append
|
||||
|
||||
# Sync calculated version and build number into pubspec.yaml
|
||||
$pubspecPath = "frontend/pubspec.yaml"
|
||||
$pubContent = Get-Content $pubspecPath
|
||||
$updatedPub = $pubContent -replace '^version:.*', "version: $verName+$buildNumber"
|
||||
Set-Content -Path $pubspecPath -Value $updatedPub -Encoding utf8
|
||||
Write-Host "Updated $pubspecPath to version: $verName+$buildNumber"
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# Manual Release Tag
|
||||
# ------------------------------------------------------------
|
||||
|
||||
+3
-1
@@ -15,7 +15,9 @@ TIS*
|
||||
!*.iss
|
||||
screenshots/
|
||||
issues/
|
||||
|
||||
.agents/
|
||||
Pictures/
|
||||
plans/
|
||||
# Environment secrets
|
||||
backend/.env
|
||||
backend/.env.*
|
||||
|
||||
+35
-10
@@ -1,28 +1,53 @@
|
||||
param (
|
||||
[switch]$patch,
|
||||
[switch]$minor,
|
||||
[switch]$major
|
||||
[switch]$major,
|
||||
[switch]$buildOnly
|
||||
)
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
Write-Host "Bumping release version..."
|
||||
if ($major) {
|
||||
dart run cider bump major
|
||||
dart run cider bump major --bump-build
|
||||
} elseif ($minor) {
|
||||
dart run cider bump minor
|
||||
} elseif ($patch) {
|
||||
dart run cider bump patch
|
||||
} else {
|
||||
dart run cider bump minor --bump-build
|
||||
} elseif ($buildOnly) {
|
||||
dart run cider bump build
|
||||
} else {
|
||||
# Default to bumping patch version and build number on every release
|
||||
dart run cider bump patch --bump-build
|
||||
}
|
||||
|
||||
Write-Host "Version bumped successfully!"
|
||||
# Read newly bumped version from pubspec.yaml
|
||||
$versionLine = Get-Content pubspec.yaml | Select-String '^version:' | Select-Object -First 1
|
||||
if (-not $versionLine) {
|
||||
throw "Could not find version: in pubspec.yaml"
|
||||
}
|
||||
|
||||
$rawVer = ($versionLine.Line -split ':', 2)[1].Trim()
|
||||
$verParts = $rawVer.Split('+')
|
||||
$verName = $verParts[0]
|
||||
$buildNumber = if ($verParts.Length -ge 2) { $verParts[1] } else { "1" }
|
||||
|
||||
Write-Host "New Version : $verName"
|
||||
Write-Host "Build Number: $buildNumber"
|
||||
|
||||
# Sync msix_version in pubspec.yaml
|
||||
$msixVer = "$verName.$buildNumber"
|
||||
$pubspecContent = Get-Content pubspec.yaml
|
||||
$updatedPubspec = $pubspecContent -replace '^\s*msix_version:.*', " msix_version: $msixVer"
|
||||
Set-Content -Path pubspec.yaml -Value $updatedPubspec -Encoding utf8
|
||||
|
||||
Write-Host "Version bumped successfully to $verName+$buildNumber!"
|
||||
|
||||
Write-Host "Building for Android..."
|
||||
flutter build apk --release
|
||||
flutter build apk --release --obfuscate --split-debug-info=build/app/outputs/symbols --build-name=$verName --build-number=$buildNumber
|
||||
|
||||
Write-Host "Building for Windows..."
|
||||
flutter build windows --release
|
||||
flutter build windows --release --obfuscate --split-debug-info=build/windows/symbols --build-name=$verName --build-number=$buildNumber
|
||||
|
||||
Write-Host "Building MSIX..."
|
||||
dart run msix:create
|
||||
|
||||
Write-Host "Build complete!"
|
||||
Write-Host "Build complete for version $verName (Build $buildNumber)!"
|
||||
@@ -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.0+1
|
||||
version: 1.0.1+2
|
||||
|
||||
environment:
|
||||
sdk: ^3.11.5
|
||||
@@ -158,6 +158,6 @@ msix_config:
|
||||
display_name: TIS RMS
|
||||
publisher_display_name: BSIT3DSB
|
||||
identity_name: plsp.bsit3dsb.tisrms
|
||||
msix_version: 1.0.0.1
|
||||
msix_version: 1.0.1.2
|
||||
logo_path: "assets/images/logo.png"
|
||||
capabilities: internetClient
|
||||
Reference in new issue
Block a user