diff --git a/AGENTS.md b/AGENTS.md index c78770d..a13385a 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -93,9 +93,11 @@ Do not manually hardcode release versions in the committed `meta.lsx` for each r Release preparation rule: -- before creating a release tag, run `scripts/set-version.ps1 -VersionTag ` to update repository `Mods/DnD 5.5e AIO Russian/meta.lsx` +- use `ModuleInfo/Version64` in `meta.lsx` as the source of truth for release tagging +- if `meta.lsx` version was changed manually (for example via BG3 Toolkit), publish using a tag that matches this exact version +- if `meta.lsx` version still matches the latest released tag, first bump version in `meta.lsx` (for example via `scripts/set-version.ps1 -VersionTag `), then commit and only after that create/push the release tag - only after that commit the change and create/push the release tag -- if `meta.lsx` version was changed manually (for example via BG3 Toolkit), publish using a tag that matches that exact version and do not use a different tag +- `PublishVersion` must not be modified during release preparation ## info.json Expectations diff --git a/scripts/set-version.ps1 b/scripts/set-version.ps1 index 765c29c..b30ccd1 100644 --- a/scripts/set-version.ps1 +++ b/scripts/set-version.ps1 @@ -37,11 +37,17 @@ if (-not (Test-Path -LiteralPath $resolvedMetaPath)) { $resolvedVersion64 = Convert-VersionTagToVersion64 -Tag $VersionTag $metaContent = Get-Content -LiteralPath $resolvedMetaPath -Raw -$versionPattern = '()' -if ($metaContent -notmatch $versionPattern) { - throw "Version64 attributes were not found in '$resolvedMetaPath'." +$moduleInfoVersionPattern = '(?s)(.*?)' +if ($metaContent -notmatch $moduleInfoVersionPattern) { + throw "ModuleInfo/Version64 attribute was not found in '$resolvedMetaPath'." } -$updatedMeta = $metaContent -replace $versionPattern, "`${1}$resolvedVersion64`${2}" + +$updatedMeta = [regex]::Replace( + $metaContent, + $moduleInfoVersionPattern, + "`${1}$resolvedVersion64`${2}", + 1 +) $utf8Bom = New-Object System.Text.UTF8Encoding($true) [System.IO.File]::WriteAllText($resolvedMetaPath, $updatedMeta, $utf8Bom)