AstroFrame/packaging/Build-ServerRelease.ps1
Elijah 4e6d21de5a
Some checks are pending
Release AstroFrame / packages (push) Waiting to run
Automate Windows and Linux releases with Forgejo Actions
2026-10-03 19:31:43 -07:00

16 lines
1 KiB
PowerShell

#requires -Version 7.0
param([string]$Ref = $env:RELEASE_REF)
$ErrorActionPreference = 'Stop'
Set-Location (Split-Path $PSScriptRoot)
[xml]$props = Get-Content Directory.Build.props
$version = [string]$props.Project.PropertyGroup.Version
if ($version -notmatch '^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$') { throw 'Directory.Build.props must contain a stable version such as 1.0.0.' }
if ($Ref -like 'refs/tags/*' -and $Ref -cne "refs/tags/v$version") {
throw "Release tag $Ref does not match version $version in Directory.Build.props."
}
if (!$Ref) { throw 'Supply the source ref, for example -Ref refs/tags/v1.0.0 or -Ref refs/heads/main for a build-only run.' }
Write-Output "Validating AstroFrame $version from $Ref"
& ./Build.ps1 -Test
if ($LASTEXITCODE) { throw 'Release validation failed.' }
& ./packaging/Release.ps1 -Version $version -Platform Both -PublishRoot artifacts/server-release/publish -Output artifacts/server-release/packages
Write-Output "Windows and Linux packages ready for AstroFrame $version."