mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-04-13 12:37:07 +00:00
add logic to add pr postfix for pr triggered builds
This commit is contained in:
parent
83ca3ee350
commit
a26c951dba
1 changed files with 32 additions and 30 deletions
62
.github/scripts/GenerateVersionNumber.ps1
vendored
62
.github/scripts/GenerateVersionNumber.ps1
vendored
|
|
@ -20,37 +20,39 @@ Foreach ($version in $latestVersions) {
|
||||||
$newVersion = [version]$latestVersion
|
$newVersion = [version]$latestVersion
|
||||||
$phase = ""
|
$phase = ""
|
||||||
$newVersionString = ""
|
$newVersionString = ""
|
||||||
if([string]::IsNullOrEmpty($Env:GITHUB_REF)) {
|
|
||||||
$phase = 'fork'
|
switch -regex ($Env:GITHUB_REF) {
|
||||||
$newVersionString = "{0}.{1}.{2}-{3}-{4}" -f $newVersion.Major, $newVersion.Minor, ($newVersion.Build + 1), $phase, $Env:GITHUB_RUN_NUMBER
|
'^refs\/pull\/*.' {
|
||||||
} else {
|
$splitRef = $Env:GITHUB_REF -split "/"
|
||||||
switch -regex ($Env:GITHUB_REF) {
|
$phase = "pr$($splitRef[2])"
|
||||||
'^refs\/heads\/main*.' {
|
$newVersionString = "{0}.{1}.{2}-{3}-{4}" -f $newVersion.Major, $newVersion.Minor, ($newVersion.Build + 1), $phase, $Env:GITHUB_RUN_NUMBER
|
||||||
$newVersionString = "{0}.{1}.{2}" -f $newVersion.Major, $newVersion.Minor, $newVersion.Build
|
|
||||||
}
|
|
||||||
'^refs\/heads\/feature\/*.' {
|
|
||||||
$phase = 'alpha'
|
|
||||||
$newVersionString = "{0}.{1}.{2}-{3}-{4}" -f $newVersion.Major, $newVersion.Minor, ($newVersion.Build + 1), $phase, $Env:GITHUB_RUN_NUMBER
|
|
||||||
}
|
|
||||||
'^refs\/heads\/release\/*.' {
|
|
||||||
$splitRef = $Env:GITHUB_REF -split "/"
|
|
||||||
$version = [version]($splitRef[-1] -replace "v", "")
|
|
||||||
$phase = 'rc'
|
|
||||||
$newVersionString = "{0}.{1}.{2}-{3}-{4}" -f $version.Major, $version.Minor, $version.Build, $phase, $Env:GITHUB_RUN_NUMBER
|
|
||||||
}
|
|
||||||
'^refs\/heads\/development*.' {
|
|
||||||
$phase = 'beta'
|
|
||||||
$newVersionString = "{0}.{1}.{2}-{3}-{4}" -f $newVersion.Major, $newVersion.Minor, ($newVersion.Build + 1), $phase, $Env:GITHUB_RUN_NUMBER
|
|
||||||
}
|
|
||||||
'^refs\/heads\/hotfix\/*.' {
|
|
||||||
$phase = 'hotfix'
|
|
||||||
$newVersionString = "{0}.{1}.{2}-{3}-{4}" -f $newVersion.Major, $newVersion.Minor, ($newVersion.Build + 1), $phase, $Env:GITHUB_RUN_NUMBER
|
|
||||||
}
|
|
||||||
'^refs\/heads\/bugfix\/*.' {
|
|
||||||
$phase = 'hotfix'
|
|
||||||
$newVersionString = "{0}.{1}.{2}-{3}-{4}" -f $newVersion.Major, $newVersion.Minor, ($newVersion.Build + 1), $phase, $Env:GITHUB_RUN_NUMBER
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
'^refs\/heads\/main*.' {
|
||||||
|
$newVersionString = "{0}.{1}.{2}" -f $newVersion.Major, $newVersion.Minor, $newVersion.Build
|
||||||
|
}
|
||||||
|
'^refs\/heads\/feature\/*.' {
|
||||||
|
$phase = 'alpha'
|
||||||
|
$newVersionString = "{0}.{1}.{2}-{3}-{4}" -f $newVersion.Major, $newVersion.Minor, ($newVersion.Build + 1), $phase, $Env:GITHUB_RUN_NUMBER
|
||||||
|
}
|
||||||
|
'^refs\/heads\/release\/*.' {
|
||||||
|
$splitRef = $Env:GITHUB_REF -split "/"
|
||||||
|
$version = [version]($splitRef[-1] -replace "v", "")
|
||||||
|
$phase = 'rc'
|
||||||
|
$newVersionString = "{0}.{1}.{2}-{3}-{4}" -f $version.Major, $version.Minor, $version.Build, $phase, $Env:GITHUB_RUN_NUMBER
|
||||||
|
}
|
||||||
|
'^refs\/heads\/development*.' {
|
||||||
|
$phase = 'beta'
|
||||||
|
$newVersionString = "{0}.{1}.{2}-{3}-{4}" -f $newVersion.Major, $newVersion.Minor, ($newVersion.Build + 1), $phase, $Env:GITHUB_RUN_NUMBER
|
||||||
|
}
|
||||||
|
'^refs\/heads\/hotfix\/*.' {
|
||||||
|
$phase = 'hotfix'
|
||||||
|
$newVersionString = "{0}.{1}.{2}-{3}-{4}" -f $newVersion.Major, $newVersion.Minor, ($newVersion.Build + 1), $phase, $Env:GITHUB_RUN_NUMBER
|
||||||
|
}
|
||||||
|
'^refs\/heads\/bugfix\/*.' {
|
||||||
|
$phase = 'hotfix'
|
||||||
|
$newVersionString = "{0}.{1}.{2}-{3}-{4}" -f $newVersion.Major, $newVersion.Minor, ($newVersion.Build + 1), $phase, $Env:GITHUB_RUN_NUMBER
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue