diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 992fd6c..3965f30 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 # ------------------------------------------------------------ diff --git a/.gitignore b/.gitignore index c98d5f7..d30972a 100644 --- a/.gitignore +++ b/.gitignore @@ -15,7 +15,9 @@ TIS* !*.iss screenshots/ issues/ - +.agents/ +Pictures/ +plans/ # Environment secrets backend/.env backend/.env.* diff --git a/frontend/build_release.ps1 b/frontend/build_release.ps1 index 0a2e694..842e9ae 100644 --- a/frontend/build_release.ps1 +++ b/frontend/build_release.ps1 @@ -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)!" diff --git a/frontend/pubspec.yaml b/frontend/pubspec.yaml index 49d753e..4defbfb 100644 --- a/frontend/pubspec.yaml +++ b/frontend/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.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 \ No newline at end of file