From cdfd9e41a9a531bf34f11d0eb0d9d2cfeb35b802 Mon Sep 17 00:00:00 2001 From: Kaj Kowalski Date: Mon, 10 Aug 2026 13:56:38 +0200 Subject: [PATCH] Use postfixed formatter release tags --- .github/workflows/formatter-npm-release.yml | 4 ++-- .github/workflows/formatter-wasm-release.yml | 4 ++-- Formatter/Dprint/Program.cs | 2 +- Formatter/Dprint/README.md | 9 +++++---- Formatter/Dprint/schema.json | 2 +- Formatter/Dprint/scripts/check-plugin.mjs | 2 +- Formatter/Wasm/README.md | 4 ++-- Formatter/Wasm/package.json | 2 +- docs/FormatterWasm.md | 4 ++-- 9 files changed, 17 insertions(+), 16 deletions(-) diff --git a/.github/workflows/formatter-npm-release.yml b/.github/workflows/formatter-npm-release.yml index 7788bc1ed..7c2a9aad2 100644 --- a/.github/workflows/formatter-npm-release.yml +++ b/.github/workflows/formatter-npm-release.yml @@ -1,5 +1,5 @@ name: Release PowerShell formatter npm package -on: { push: { tags: ["npm-[0-9]+.[0-9]+.[0-9]+"] } } +on: { push: { tags: ["[0-9]+.[0-9]+.[0-9]+-npm"] } } permissions: { contents: write } defaults: { run: { shell: pwsh } } jobs: @@ -17,7 +17,7 @@ jobs: run: | $package = Get-Content -LiteralPath package.json -Raw | ConvertFrom-Json $packageVersion = [string] $package.version - $expectedTag = "npm-$packageVersion" + $expectedTag = "$packageVersion-npm" if ($env:GITHUB_REF_NAME -cne $expectedTag) { $message = "Tag {0} does not match npm package tag {1}." -f $env:GITHUB_REF_NAME, $expectedTag "::error::$message" diff --git a/.github/workflows/formatter-wasm-release.yml b/.github/workflows/formatter-wasm-release.yml index 9f72ff281..c8dfa1743 100644 --- a/.github/workflows/formatter-wasm-release.yml +++ b/.github/workflows/formatter-wasm-release.yml @@ -1,5 +1,5 @@ name: Release dprint PowerShell formatter -on: { push: { tags: ["dprint-[0-9]+.[0-9]+.[0-9]+"] } } +on: { push: { tags: ["[0-9]+.[0-9]+.[0-9]+-dprint"] } } permissions: { contents: write } defaults: { run: { shell: pwsh } } jobs: @@ -23,7 +23,7 @@ jobs: "::error::$message" throw $message } - $expectedTag = "dprint-$version" + $expectedTag = "$version-dprint" if ($env:GITHUB_REF_NAME -cne $expectedTag) { $message = "Tag {0} does not match dprint plugin tag {1}." -f $env:GITHUB_REF_NAME, $expectedTag "::error::$message" diff --git a/Formatter/Dprint/Program.cs b/Formatter/Dprint/Program.cs index c6c21e594..0fe3a203d 100644 --- a/Formatter/Dprint/Program.cs +++ b/Formatter/Dprint/Program.cs @@ -24,7 +24,7 @@ public static class Plugin private const string RepositoryUrl = $"https://github.com/{RepositoryPath}"; private static readonly string Version = GetVersion(); private static readonly string ConfigSchemaUrl = - $"https://plugins.dprint.dev/{RepositoryPath}/{Version}/schema.json"; + $"https://plugins.dprint.dev/{RepositoryPath}/{Version}-dprint/schema.json"; private static readonly HashSet KnownProperties = [ diff --git a/Formatter/Dprint/README.md b/Formatter/Dprint/README.md index e02a5c5b8..498cd7451 100644 --- a/Formatter/Dprint/README.md +++ b/Formatter/Dprint/README.md @@ -119,18 +119,19 @@ node Formatter/Dprint/scripts/generate-schema.mjs \ ## Release The plugin version is the `Version` property in `Formatter/Dprint/Formatter.Dprint.csproj`. Its Git -tag, published dprint version, and schema URL use that same bare semantic version. The dprint proxy -does not accept dashes in plugin tags, so `dprint-` is not a valid registry release tag. +tag uses the `-dprint` namespace, while the published dprint version remains `Version`. +The schema URL contains the full release tag so the dprint proxy resolves the namespaced GitHub +release without falling back to a bare version tag. The repository also contains PSScriptAnalyzer's historical tags. The release workflow therefore -refuses to publish unless the pushed tag exactly matches the dprint project's declared version. +refuses to publish unless the pushed tag exactly matches `-dprint`. To publish a new immutable release: 1. Update `Version`, build the module, and regenerate `schema.json`. 2. Run `mise exec -- Formatter/Dprint/scripts/e2e.sh` and commit the version, schema, and related changes. -3. Create and push a signed `` tag for that exact signed commit. +3. Create and push a signed `-dprint` tag for that exact signed commit. 4. Follow the `Release dprint PowerShell formatter` workflow through completion. 5. Verify that the GitHub release contains `plugin.wasm`, `schema.json`, `LICENSE`, and `checksums.txt`, then diff --git a/Formatter/Dprint/schema.json b/Formatter/Dprint/schema.json index 4daf81c00..a3d80e864 100644 --- a/Formatter/Dprint/schema.json +++ b/Formatter/Dprint/schema.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://plugins.dprint.dev/kjanat/PSScriptAnalyzer/0.1.1/schema.json", + "$id": "https://plugins.dprint.dev/kjanat/PSScriptAnalyzer/0.1.1-dprint/schema.json", "title": "dprint PowerShell formatter configuration", "type": "object", "additionalProperties": false, diff --git a/Formatter/Dprint/scripts/check-plugin.mjs b/Formatter/Dprint/scripts/check-plugin.mjs index ca430323c..65d98c705 100644 --- a/Formatter/Dprint/scripts/check-plugin.mjs +++ b/Formatter/Dprint/scripts/check-plugin.mjs @@ -57,7 +57,7 @@ assert.equal(info.configKey, "powershell"); assert.equal(info.helpUrl, "https://github.com/kjanat/PSScriptAnalyzer"); assert.equal( info.configSchemaUrl, - `https://plugins.dprint.dev/kjanat/PSScriptAnalyzer/${expectedVersion}/schema.json`, + `https://plugins.dprint.dev/kjanat/PSScriptAnalyzer/${expectedVersion}-dprint/schema.json`, ); assert.equal( info.updateUrl, diff --git a/Formatter/Wasm/README.md b/Formatter/Wasm/README.md index 3f29c412f..9caa8197e 100644 --- a/Formatter/Wasm/README.md +++ b/Formatter/Wasm/README.md @@ -27,11 +27,11 @@ dotnet publish Formatter/Wasm/Formatter.Wasm.csproj -c Release The publishable package is written to `Formatter/Wasm/bin/Release/net8.0/browser-wasm/AppBundle`. -Release tags use the package-specific `npm-` namespace. Download and install the GitHub +Release tags use the package-specific `-npm` namespace. Download and install the GitHub release tarball directly with: ```sh -npm install https://github.com/kjanat/PSScriptAnalyzer/releases/download/npm-0.1.0/psscriptanalyzer-formatter-wasm-0.1.0.tgz +npm install https://github.com/kjanat/PSScriptAnalyzer/releases/download/0.1.1-npm/psscriptanalyzer-formatter-wasm-0.1.1.tgz ``` See [WebAssembly formatter development](../../docs/FormatterWasm.md) for the architecture, complete diff --git a/Formatter/Wasm/package.json b/Formatter/Wasm/package.json index 8a130a055..eb6dd7644 100644 --- a/Formatter/Wasm/package.json +++ b/Formatter/Wasm/package.json @@ -1,6 +1,6 @@ { "name": "@psscriptanalyzer/formatter-wasm", - "version": "0.1.0", + "version": "0.1.1", "description": "Parser-backed PowerShell formatter for browsers and Node.js", "license": "MIT", "repository": { diff --git a/docs/FormatterWasm.md b/docs/FormatterWasm.md index f9d823b55..98a9c03af 100644 --- a/docs/FormatterWasm.md +++ b/docs/FormatterWasm.md @@ -220,8 +220,8 @@ real dprint formatting, idempotence, configuration diagnostics, and invalid UTF- ## Release namespaces -Dprint releases use `dprint-` tags such as `dprint-0.1.1`. Browser and Node.js package -releases use the separate `npm-` namespace. +Dprint releases use `-dprint` tags such as `0.1.1-dprint`. Browser and Node.js package +releases use the separate `-npm` namespace. The dprint proxy selects the newest non-draft, non-prerelease GitHub release when producing `latest.json`. The npm workflow therefore publishes its GitHub release as a prerelease. This keeps