This commit is contained in:
Ivan Fontosh
2026-05-18 08:35:36 +08:00
parent 4e5d320c36
commit cfa067519d
6 changed files with 167 additions and 18 deletions
Binary file not shown.
+45 -2
View File
@@ -1,2 +1,45 @@
Copy publish.ps1, publish.cmd, publish-config.json to D:\TTRPG-Release\
when updating the release publisher tool.
TTRPG Release folder
====================
RECOMMENDED WORKFLOW (same version on all platforms)
----------------------------------------------------
1) bump-version.cmd
OR in project: npm version patch --no-git-tag-version
2) On Mac: npm ci && npm run build && npm run pack:mac
Copy to D:\TTRPG-Release:
latest-mac.yml, TTRPGPlayer-x64.zip, TTRPGPlayer-arm64.zip (+ dmg optional)
3) release-all.cmd
- does NOT bump version (default -AfterMac)
- checks Mac files match package.json version
- builds Windows + Linux, copies artifacts, publishes to updates.mailib.ru
LEGACY (Win/Linux ahead of Mac)
-------------------------------
release-all-bump.cmd - bumps patch in script, build Win/Linux, publish with -SkipMac or add Mac later
SCRIPTS
+11
View File
@@ -0,0 +1,11 @@
@echo off
REM Bump patch in package.json only (no git tag). Run BEFORE Mac build.
cd /d "D:\Work\my_projects\dnd_project\dnd_player"
call npm version patch --no-git-tag-version
if errorlevel 1 pause & exit /b 1
echo.
echo Version bumped. Next:
echo 1) npm run pack:mac on Mac
echo 2) Copy latest-mac.yml + TTRPGPlayer-*.zip to D:\TTRPG-Release
echo 3) release-all.cmd
pause
+88 -12
View File
@@ -1,17 +1,26 @@
# Prepare TTRPG release: bump version, git push, build Win/Linux, copy to release folder.
# Prepare TTRPG release: build Win/Linux, copy to release folder.
# Run: prepare-release.cmd
#
# Recommended (Mac first, same version on all platforms):
# 1) Bump version in package.json manually (npm version patch --no-git-tag-version)
# 2) pack:mac on Mac, copy latest-mac.yml + *.zip to release folder
# 3) prepare-release.cmd -AfterMac (or release-all.cmd)
#
# Options:
# -Version 1.0.17 explicit version (skip auto bump)
# -Patch bump patch (default)
# -Minor bump minor
# -AfterMac do not bump; require Mac files in release folder (default in release-all)
# -Bump bump patch before build (Mac can be added later)
# -Version 1.0.17 set explicit version (with -Bump workflow)
# -Minor bump minor (with -Bump)
# -SkipGit skip commit/push
# -SkipLinux skip Linux build (WSL)
# -NoBump do not change package.json version
# -NoBump do not change package.json (same as -AfterMac without Mac check)
param(
[string]$Version = '',
[switch]$Patch,
[switch]$Minor,
[switch]$Bump,
[switch]$AfterMac,
[switch]$SkipGit,
[switch]$SkipLinux,
[switch]$NoBump
@@ -149,6 +158,45 @@ function Push-Git([string]$ProjectRoot, [string]$Remote, [string]$McpConfigPath)
}
}
function Get-YmlField([string]$ymlPath, [string]$fieldName) {
$content = Get-Content -LiteralPath $ymlPath -Raw -Encoding UTF8
$m = [regex]::Match($content, "(?m)^${fieldName}:\s*(\S+)\s*$")
if ($m.Success) {
return $m.Groups[1].Value.Trim()
}
return $null
}
function Test-MacReleaseReady {
param(
[string]$ReleaseDir,
[string]$ExpectedVersion
)
$macYml = Join-Path $ReleaseDir 'latest-mac.yml'
if (-not (Test-Path -LiteralPath $macYml)) {
throw @"
AfterMac: missing latest-mac.yml in $ReleaseDir
1) Bump version in package.json (now $ExpectedVersion)
2) npm run pack:mac on Mac
3) Copy latest-mac.yml + TTRPGPlayer-*.zip into release folder
4) Run prepare-release.cmd -AfterMac again
"@
}
$macVersion = Get-YmlField $macYml 'version'
if ($macVersion -and $macVersion -ne $ExpectedVersion) {
throw "AfterMac: latest-mac.yml is v$macVersion but package.json is v$ExpectedVersion. Align versions before building Win/Linux."
}
$primary = Get-YmlField $macYml 'path'
if (-not $primary) {
throw 'AfterMac: latest-mac.yml has no path: entry'
}
$primaryPath = Join-Path $ReleaseDir $primary
if (-not (Test-Path -LiteralPath $primaryPath)) {
throw "AfterMac: missing Mac update file $primary (path in latest-mac.yml). Copy zip from Mac build."
}
Write-Ok "Mac feed v$ExpectedVersion, primary: $primary"
}
function Copy-ReleaseArtifacts {
param(
[string]$BuildReleaseDir,
@@ -228,12 +276,36 @@ Write-Host '=== TTRPG Prepare Release ===' -ForegroundColor Cyan
Write-Host "Project: $projectRoot"
Write-Host "Release folder: $releaseDir"
# Step 1 - version
Write-Step 1 'Bump version'
$currentVersion = Read-PackageVersion $packageJson
$newVersion = $currentVersion
if ($AfterMac) {
$NoBump = $true
}
if ($Bump -and $AfterMac) {
throw 'Use either -Bump or -AfterMac, not both'
}
if ($Bump) {
$Patch = $true
}
if ($NoBump) {
$currentVersion = Read-PackageVersion $packageJson
if ($AfterMac) {
Write-Step 0 'Mac artifacts check'
Test-MacReleaseReady $releaseDir $currentVersion
}
# Step 1 - version
if ($AfterMac) {
Write-Step 1 'Version (unchanged, Mac-first workflow)'
$newVersion = $currentVersion
Write-Ok "building Win/Linux at v$newVersion (same as Mac feed)"
} else {
Write-Step 1 'Bump version'
$newVersion = $currentVersion
}
if ($AfterMac) {
# version step done above
} elseif ($NoBump) {
Write-Ok "version unchanged: $currentVersion"
$newVersion = $currentVersion
} elseif ($Version) {
@@ -310,8 +382,12 @@ Write-Host '=== Prepare release done ===' -ForegroundColor Green
Write-Host "Version: $newVersion"
Write-Host ''
Write-Host 'Next steps:' -ForegroundColor Yellow
Write-Host ' 1) Copy Mac files (latest-mac.yml, TTRPGPlayer-*.zip, optional *.dmg) from Mac into release folder if needed'
Write-Host ' 2) Run publish.cmd to validate and upload to updates.mailib.ru'
if ($AfterMac) {
Write-Host ' Run publish.cmd (release-all continues to publish automatically)'
} else {
Write-Host ' 1) Copy Mac files (latest-mac.yml, TTRPGPlayer-*.zip) from Mac into release folder'
Write-Host ' 2) Run release-all.cmd (default -AfterMac) or publish.cmd'
}
Write-Host ''
exit 0
@@ -0,0 +1,5 @@
@echo off
REM Legacy: bump version in script, then Win/Linux (Mac files added later).
cd /d "%~dp0"
powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0release-all.ps1" -Bump %*
if errorlevel 1 pause
+18 -4
View File
@@ -1,13 +1,17 @@
# Copy of D:\TTRPG-Release\release-all.ps1
# Full release: prepare (build Win/Linux, copy) then publish (validate + upload).
# Run: release-all.cmd (default: -AfterMac, version already set, Mac files in release folder)
# release-all-bump.cmd (bump version first, Mac later)
param(
[string]$Version = '',
[switch]$Patch,
[switch]$Bump,
[switch]$AfterMac,
[switch]$Minor,
[switch]$SkipGit,
[switch]$SkipLinux,
[switch]$NoBump,
[switch]$CheckOnlyPublish
[switch]$CheckOnlyPublish,
[switch]$SkipMac
)
Set-StrictMode -Version Latest
@@ -24,9 +28,18 @@ if (-not (Test-Path -LiteralPath $PublishScript)) {
throw "Missing publish.ps1: $PublishScript"
}
$useAfterMac = $AfterMac
if ($Bump -and $AfterMac) {
throw 'Use either -Bump or -AfterMac, not both'
}
if (-not $Bump -and -not $PSBoundParameters.ContainsKey('AfterMac')) {
$useAfterMac = $true
}
$prepareArgs = @()
if ($Version) { $prepareArgs += '-Version', $Version }
if ($Patch) { $prepareArgs += '-Patch' }
if ($Bump) { $prepareArgs += '-Bump' }
if ($useAfterMac) { $prepareArgs += '-AfterMac' }
if ($Minor) { $prepareArgs += '-Minor' }
if ($SkipGit) { $prepareArgs += '-SkipGit' }
if ($SkipLinux) { $prepareArgs += '-SkipLinux' }
@@ -34,6 +47,7 @@ if ($NoBump) { $prepareArgs += '-NoBump' }
$publishArgs = @()
if ($CheckOnlyPublish) { $publishArgs += '-CheckOnly' }
if ($SkipMac) { $publishArgs += '-SkipMac' }
Write-Host '=== TTRPG Full Release ===' -ForegroundColor Cyan
Write-Host ''