mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-07-12 12:20:13 +08:00
mod: fvmrc [skip ci]
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -146,4 +146,6 @@ pili_release.json
|
|||||||
|
|
||||||
dist
|
dist
|
||||||
|
|
||||||
test.dart
|
test.dart
|
||||||
|
|
||||||
|
.fvmrc
|
||||||
@@ -5,27 +5,36 @@ param(
|
|||||||
try {
|
try {
|
||||||
$versionName = $null
|
$versionName = $null
|
||||||
|
|
||||||
|
$flutterVersion = $null
|
||||||
|
|
||||||
$versionCode = [int](git rev-list --count HEAD).Trim()
|
$versionCode = [int](git rev-list --count HEAD).Trim()
|
||||||
|
|
||||||
$commitHash = (git rev-parse HEAD).Trim()
|
$commitHash = (git rev-parse HEAD).Trim()
|
||||||
|
|
||||||
$updatedContent = foreach ($line in (Get-Content -Path 'pubspec.yaml' -Encoding UTF8)) {
|
$updatedContent = foreach ($line in (Get-Content -Path 'pubspec.yaml' -Encoding UTF8)) {
|
||||||
if ($line -match '^\s*version:\s*([\d\.]+)') {
|
if ($line -match '^\s*(version|flutter):\s*([\d\.]+)') {
|
||||||
$versionName = $matches[1]
|
if ('version' -eq $matches[1]) {
|
||||||
if ($Arg -eq 'android') {
|
$versionName = $matches[2]
|
||||||
$versionName += '-' + $commitHash.Substring(0, 9)
|
if ('android' -eq $Arg) {
|
||||||
|
$versionName += '-' + $commitHash.Substring(0, 9)
|
||||||
|
}
|
||||||
|
"version: $versionName+$versionCode"
|
||||||
|
} else {
|
||||||
|
$flutterVersion = $matches[2]
|
||||||
|
$line
|
||||||
}
|
}
|
||||||
"version: $versionName+$versionCode"
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$line
|
$line
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($null -eq $versionName) {
|
if ($null -eq $versionName -or $null -eq $flutterVersion) {
|
||||||
throw 'version not found'
|
throw 'version not found'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Set-Content -Path '.fvmrc' -Value "{`"flutter`":`"$flutterVersion`"}"
|
||||||
|
|
||||||
$updatedContent | Set-Content -Path 'pubspec.yaml' -Encoding UTF8
|
$updatedContent | Set-Content -Path 'pubspec.yaml' -Encoding UTF8
|
||||||
|
|
||||||
$buildTime = [int]([DateTimeOffset]::Now.ToUnixTimeSeconds())
|
$buildTime = [int]([DateTimeOffset]::Now.ToUnixTimeSeconds())
|
||||||
|
|||||||
Reference in New Issue
Block a user