Files
CommandForge/scripts/pack.ps1
T
poli0981andClaude Opus 4.8 ef83c88083 build: add assembly metadata + Velopack --packAuthors
Đợt 1 of the post-v1.0 line (metadata + packaging).

- Directory.Build.props: inheritable package/assembly metadata
  (Product, Authors/Company=poli0981, Copyright, Description,
  RepositoryUrl/PackageProjectUrl, default Version 1.0.0).
  AssemblyVersion is intentionally NOT pinned so it follows Version
  (stamped from the git tag at publish), keeping the in-app About /
  Report-Bug version accurate.
- scripts/pack.ps1: pass --packTitle / --packAuthors to vpk pack
  (correct plural flag) and -p:FileVersion to dotnet publish.
- tests: AssemblyMetadataTests verifies Company / Product / Copyright.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-19 13:58:54 +07:00

58 lines
2.0 KiB
PowerShell

#requires -Version 7
<#
.SYNOPSIS
Publishes CommandForge self-contained and packages it with Velopack (vpk) for GitHub Releases.
.DESCRIPTION
Phase 4 release helper (no CI — that is Phase 6). Produces, under Releases/:
CommandForge-win-Setup.exe, RELEASES, *-full.nupkg, *-delta.nupkg
Update is per-user (no UAC). The Elevator is copied into the publish dir by the
CopyElevatorOnPublish MSBuild target, so vpk packages it automatically.
.PARAMETER Version
SemVer package version, e.g. 0.3.0 (no leading 'v'). Should match the git tag vX.Y.Z.
.EXAMPLE
./scripts/pack.ps1 -Version 0.3.0
#>
[CmdletBinding()]
param(
[Parameter(Mandatory = $true)]
[string] $Version,
[string] $Runtime = 'win-x64',
[string] $Configuration = 'Release'
)
$ErrorActionPreference = 'Stop'
$repoRoot = Split-Path -Parent $PSScriptRoot
$publishDir = Join-Path $repoRoot "publish/$Runtime"
$wpfProject = Join-Path $repoRoot 'src/CommandForge.Wpf'
Write-Host "Publishing CommandForge $Version ($Runtime, $Configuration)..." -ForegroundColor Cyan
# Stamp the assembly version so the in-app "App version" (Settings -> About, Report Bug) matches
# the released package version; otherwise it stays at the 1.0.0 default regardless of the tag.
dotnet publish $wpfProject `
-c $Configuration -r $Runtime --self-contained true `
-p:PublishSingleFile=false `
-p:Version=$Version -p:FileVersion=$Version -p:InformationalVersion=$Version `
-o $publishDir
# vpk is the Velopack CLI: dotnet tool install -g vpk
if (-not (Get-Command vpk -ErrorAction SilentlyContinue)) {
throw "vpk not found. Install it with: dotnet tool install -g vpk"
}
Write-Host "Packing with Velopack..." -ForegroundColor Cyan
vpk pack `
--packId CommandForge `
--packTitle CommandForge `
--packAuthors poli0981 `
--packVersion $Version `
--packDir $publishDir `
--mainExe CommandForge.Wpf.exe
Write-Host "Done. Artifacts are in $(Join-Path $repoRoot 'Releases')." -ForegroundColor Green