9b2abef4e1
Converges all five clients on one version after four had drifted onto the already-published 0.1.2/0.1.1 while their APIs kept changing underneath it: - Rust Cargo.toml [package] + [workspace.package] -> 0.2.0 (CLIENT_VERSION already derives from CARGO_PKG_VERSION, no separate edit). - Python pyproject.toml + version.py -> 0.2.0; new test asserts __version__ matches pyproject.toml (closes the CLI-26 residual drift mode). - Go mxgateway/version.go ClientVersion -> 0.2.0. - .NET ZB.MOM.WW.MxGateway.Client.csproj <Version> -> 0.2.0. - Java -> 0.2.1, not 0.2.0: the live Gitea Maven feed already had 0.2.0 published (2026-06-26), before the CLI-37/38/40/41 conformance fixes changed the client's observable behavior, so reusing 0.2.0 would label two different APIs identically. Recorded as an exception in docs/ClientPackaging.md's new Versioning section. Publish-pipeline guards: - scripts/tag-go-module.ps1 implements the CLI-21 guard: after semver validation it refuses to tag unless clients/go/mxgateway/version.go's ClientVersion already matches the requested tag version. - scripts/pack-clients.ps1 gains a Gitea package-registry collision guard wired into every per-language -Publish step; it aborts if the target name+version already exists rather than force-overwriting. Verified live against the real Gitea registry (credentials already present in this environment) — correctly refuses on every known-published artifact and passes on every unpublished target. Docs updated in the same commit: docs/ClientPackaging.md (new Versioning section), and the five client READMEs' stale 0.1.1/0.1.2 example versions. No .proto changes. No publish performed.
84 lines
2.9 KiB
PowerShell
84 lines
2.9 KiB
PowerShell
#Requires -Version 7
|
|
|
|
<#
|
|
.SYNOPSIS
|
|
Tags a release of the Go MxAccessGateway client module.
|
|
|
|
.DESCRIPTION
|
|
Go modules in monorepo subdirectories use prefixed tags
|
|
("clients/go/v0.1.0") so `go get <module>@v0.1.0` resolves correctly.
|
|
This script validates the version, creates the prefixed tag at HEAD,
|
|
and (optionally) pushes it.
|
|
|
|
.PARAMETER Version
|
|
Semver tag without the prefix, e.g. "v0.1.0".
|
|
|
|
.PARAMETER Push
|
|
When set, pushes the tag to origin after creation.
|
|
|
|
.EXAMPLE
|
|
pwsh scripts/tag-go-module.ps1 -Version v0.1.0
|
|
pwsh scripts/tag-go-module.ps1 -Version v0.1.1 -Push
|
|
#>
|
|
|
|
[CmdletBinding()]
|
|
param(
|
|
[Parameter(Mandatory = $true)]
|
|
[string]$Version,
|
|
|
|
[switch]$Push
|
|
)
|
|
|
|
Set-StrictMode -Version Latest
|
|
$ErrorActionPreference = 'Stop'
|
|
|
|
if ($Version -notmatch '^v\d+\.\d+\.\d+(-[A-Za-z0-9.-]+)?$') {
|
|
throw "Version '$Version' must match semver vX.Y.Z (optionally with -prerelease suffix)."
|
|
}
|
|
|
|
# CLI-21 guard: the tag must match what the module itself reports via
|
|
# ClientVersion, or `go get <module>@vX.Y.Z` resolves a tag whose module
|
|
# code disagrees with its own version constant.
|
|
$versionGoPath = Join-Path $PSScriptRoot '..' 'clients/go/mxgateway/version.go'
|
|
if (-not (Test-Path $versionGoPath)) {
|
|
throw "Could not find '$versionGoPath' to verify ClientVersion before tagging."
|
|
}
|
|
$versionGoContent = Get-Content $versionGoPath -Raw
|
|
if ($versionGoContent -notmatch 'ClientVersion\s*=\s*"([^"]+)"') {
|
|
throw "Could not find a ClientVersion = `"...`" constant in '$versionGoPath'."
|
|
}
|
|
$clientVersion = $Matches[1]
|
|
$tagVersion = $Version.TrimStart('v')
|
|
if ($clientVersion -ne $tagVersion) {
|
|
throw "clients/go/mxgateway/version.go ClientVersion is '$clientVersion' but the requested tag is '$tagVersion'. Update ClientVersion to match before tagging."
|
|
}
|
|
|
|
$tag = "clients/go/$Version"
|
|
Write-Host "Creating Go-module tag: $tag" -ForegroundColor Cyan
|
|
|
|
# Verify we're on a clean checkout — refuse to tag with uncommitted tracked
|
|
# changes. Test each porcelain line individually: any entry that is not an
|
|
# untracked file (`??`) is a tracked change, regardless of how the entries
|
|
# happen to sort. Joining and anchoring `^\?\?` against the whole blob would
|
|
# only inspect the first line and miss tracked changes behind an untracked one.
|
|
$dirty = (git status --porcelain) | Where-Object { $_ -and ($_ -notmatch '^\?\?') }
|
|
if ($dirty) {
|
|
throw "Working tree has tracked changes. Commit or stash before tagging.`n$($dirty -join "`n")"
|
|
}
|
|
|
|
# Verify the tag doesn't already exist.
|
|
$existing = git tag --list $tag
|
|
if ($existing) {
|
|
throw "Tag '$tag' already exists. Use a new version."
|
|
}
|
|
|
|
git tag -a $tag -m "Go client release $Version"
|
|
Write-Host "Created tag: $tag" -ForegroundColor Green
|
|
|
|
if ($Push) {
|
|
git push origin $tag
|
|
Write-Host "Pushed tag to origin." -ForegroundColor Green
|
|
} else {
|
|
Write-Host "Tag not pushed. To publish, run: git push origin $tag" -ForegroundColor Yellow
|
|
}
|