Add -latest option to ue4-release.ps1

This commit is contained in:
Steve Streeting 2020-10-13 10:13:17 +01:00
parent 584d6c6666
commit 5301bed990
2 changed files with 26 additions and 6 deletions

View File

@ -11,9 +11,10 @@ release on Itch.
This script uses configuration stored in [`packageconfig.json`](./PackageConfig.md). This script uses configuration stored in [`packageconfig.json`](./PackageConfig.md).
``` ```
ue4-release.ps1 -version:ver -variants:v1,v2 -services:steam,itch [-src:sourcefolder] [-dryrun] ue4-release.ps1 [-version:ver|-latest] -variants:v1,v2 -services:steam,itch [-src:sourcefolder] [-dryrun]
-version:ver : Version to release; must have been packaged already -version:ver : Version to release; must have been packaged already
-latest : Instead of an explicit version, release one identified in project settings
-variants:var1,var2 : Name of variants to release. Omit to use DefaultVariants -variants:var1,var2 : Name of variants to release. Omit to use DefaultVariants
-services:s1,s2 : Name of services to release to. Can omit and rely on ReleaseTo -services:s1,s2 : Name of services to release to. Can omit and rely on ReleaseTo
setting of variant in packageconfig.json setting of variant in packageconfig.json
@ -25,7 +26,8 @@ This script uses configuration stored in [`packageconfig.json`](./PackageConfig.
## Uploading all builds at once ## Uploading all builds at once
The only mandatory argument is the version number. With only that argument, The only mandatory argument is the version number, which you can specify explicitly,
or use the `-latest` option to take the version from project settings. With only that argument,
the script will process all the [default variants](./PackageConfig.md#defaultvariants) the script will process all the [default variants](./PackageConfig.md#defaultvariants)
for this project and release any which have [release settings](./PackageConfig.md#defaultvariants). for this project and release any which have [release settings](./PackageConfig.md#defaultvariants).
This allows you to push all your builds for a given version at once. This allows you to push all your builds for a given version at once.

View File

@ -1,7 +1,9 @@
[CmdletBinding()] # Fail on unknown args [CmdletBinding()] # Fail on unknown args
param ( param (
# Version to release # Explicit version to release
[string]$version, [string]$version,
# Latest version option instead of explicit version
[switch]$latest,
# Variant name(s) to release; if not specified release all DefaultVariants with ReleaseTo options # Variant name(s) to release; if not specified release all DefaultVariants with ReleaseTo options
[array]$variants, [array]$variants,
# Source folder, current dir if omitted # Source folder, current dir if omitted
@ -15,6 +17,7 @@ param (
. $PSScriptRoot\inc\platform.ps1 . $PSScriptRoot\inc\platform.ps1
. $PSScriptRoot\inc\packageconfig.ps1 . $PSScriptRoot\inc\packageconfig.ps1
. $PSScriptRoot\inc\projectversion.ps1
. $PSScriptRoot\inc\filetools.ps1 . $PSScriptRoot\inc\filetools.ps1
. $PSScriptRoot\inc\steam.ps1 . $PSScriptRoot\inc\steam.ps1
. $PSScriptRoot\inc\itch.ps1 . $PSScriptRoot\inc\itch.ps1
@ -23,9 +26,10 @@ param (
function Write-Usage { function Write-Usage {
Write-Output "Steve's UE4 release tool" Write-Output "Steve's UE4 release tool"
Write-Output "Usage:" Write-Output "Usage:"
Write-Output " ue4-release.ps1 -version:ver -variant:var -services:steam,itch [-src:sourcefolder] [-dryrun]" Write-Output " ue4-release.ps1 [-version:ver|-latest] -variant:var -services:steam,itch [-src:sourcefolder] [-dryrun]"
Write-Output " " Write-Output " "
Write-Output " -version:ver : Version to release; must have been packaged already" Write-Output " -version:ver : Version to release; must have been packaged already"
Write-Output " -latest : Instead of an explicit version, release one identified in project settings"
Write-Output " -variants:var1,var2 : Name of variants to release. Omit to use DefaultVariants" Write-Output " -variants:var1,var2 : Name of variants to release. Omit to use DefaultVariants"
Write-Output " -services:s1,s2 : Name of services to release to. Can omit and rely on ReleaseTo" Write-Output " -services:s1,s2 : Name of services to release to. Can omit and rely on ReleaseTo"
Write-Output " setting of variant in packageconfig.json " Write-Output " setting of variant in packageconfig.json "
@ -46,8 +50,17 @@ if ($src.Length -eq 0) {
Write-Verbose "-src not specified, assuming current directory" Write-Verbose "-src not specified, assuming current directory"
} }
if (-not $version) { if (-not $version -and -not $latest) {
Write-Output "Mandatory argument: version" Write-Usage
Write-Output ""
Write-Output "ERROR: You must specify a version"
Exit 1
}
if ($version -and $latest) {
Write-Usage
Write-Output ""
Write-Output "ERROR: You cannot specify a -version and -latest at the same time"
Exit 1 Exit 1
} }
@ -58,6 +71,10 @@ try {
# Import config # Import config
$config = Read-Package-Config -srcfolder:$src $config = Read-Package-Config -srcfolder:$src
if ($latest) {
$version = Get-Project-Version $src
}
if ($variants) { if ($variants) {
$variantConfigs = $config.Variants | Where-Object { $_.Name -in $variants } $variantConfigs = $config.Variants | Where-Object { $_.Name -in $variants }
if ($variantConfigs.Count -ne $variants.Count) { if ($variantConfigs.Count -ne $variants.Count) {
@ -100,6 +117,7 @@ try {
Write-Output "" Write-Output ""
Write-Output "Variant : $($variantConfig.Name)" Write-Output "Variant : $($variantConfig.Name)"
Write-Output "Version : $version"
Write-Output "Source Folder : $sourcedir" Write-Output "Source Folder : $sourcedir"
Write-Output "Service(s) : $($servicesFound -join ", ")" Write-Output "Service(s) : $($servicesFound -join ", ")"
Write-Output "" Write-Output ""