From 29acaf846041cc45b4f10216b7ab401318f947ac Mon Sep 17 00:00:00 2001 From: Tomas Kral Date: Fri, 17 Jul 2026 16:52:52 +0200 Subject: [PATCH 1/4] fix(ci): align npm dist-tags with GA releases Publishing from main now uses the `next` dist-tag instead of `latest`. The `latest` tag is reserved for the auto-detected highest semver release branch (e.g., release-1.10), matching the convention used for catalog images and quay tags. Older release branches continue to use their branch name as the dist-tag. Assisted-by: Claude Code --- .github/workflows/publish.yaml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 09dbe1c..a6ef7c4 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -42,9 +42,27 @@ jobs: - name: Update npm run: npm install -g npm@11 + - name: Detect latest GA branch + id: detect-ga + run: | + # Auto-detect the latest GA release branch: + # 1. git ls-remote lists all remote release-* branches without cloning history + # 2. sed strips everything up to "release-", leaving just the version (e.g., "1.10") + # 3. sort -t. splits on "." and sorts each field numerically (-n), so + # 1.9 < 1.10 < 1.11 < 2.1 (lexicographic sort would wrongly put 1.10 before 1.9) + # 4. tail -1 picks the highest version + LATEST_GA=$(git ls-remote --heads origin 'refs/heads/release-*' \ + | sed 's|.*refs/heads/release-||' \ + | sort -t. -k1,1n -k2,2n \ + | tail -1) + echo "branch=release-${LATEST_GA}" >> "$GITHUB_OUTPUT" + - name: Publish run: | if [ "${{ inputs.branch }}" = "main" ]; then + npm publish --access public --tag next + # Check if the selected branch matches the auto-detected latest GA branch (highest semver release-* branch) + elif [ "${{ inputs.branch }}" = "${{ steps.detect-ga.outputs.branch }}" ]; then npm publish --access public else npm publish --access public --tag ${{ inputs.branch }} From 6099dd4e5b93813e91cc0b85b306361f0a868e34 Mon Sep 17 00:00:00 2001 From: Tomas Kral Date: Fri, 17 Jul 2026 17:01:06 +0200 Subject: [PATCH 2/4] docs: document npm dist-tag strategy and workflow usage Assisted-by: Claude Code --- README.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 379c4fd..3a9969f 100644 --- a/README.md +++ b/README.md @@ -92,7 +92,19 @@ Publishing is done using [Publish Package to NPM](.github/workflows/publish.yaml **Make sure not to release MINOR or MAJOR version that are not aligned with the corresponding RHDH release.** -This workflow is **not** currently triggered automatically. It needs to be run manually from the [Actions tab](https://github.com/redhat-developer/rhdh-cli/actions/workflows/publish.yaml) in the GitHub repository. +This workflow is **not** currently triggered automatically. It needs to be run manually from the [Actions tab](https://github.com/redhat-developer/rhdh-cli/actions/workflows/publish.yaml) in the GitHub repository. Always run the workflow from the `main` branch (the "Use workflow from" dropdown) and select the target release branch via the `branch` input parameter. This ensures the latest workflow definition is used. + +#### NPM dist-tags + +The workflow automatically assigns npm dist-tags based on the selected branch: + +| Branch | Dist-tag | Example | +| --- | --- | --- | +| `main` | `next` | `npm install @red-hat-developer-hub/cli@next` | +| Latest GA release branch (auto-detected) | `latest` | `npm install @red-hat-developer-hub/cli@latest` | +| Older release branches | Branch name (e.g., `release-1.9`) | `npm install @red-hat-developer-hub/cli@release-1.9` | + +The latest GA branch is auto-detected as the `release-*` branch with the highest semver version. Plugin builders targeting a specific RHDH version should use a semver range (e.g., `~1.10.0`) or the corresponding branch tag rather than `latest`. ## Reporting Issues From 7301fd1ab7bf44d5403095181058fba9bbecd4ff Mon Sep 17 00:00:00 2001 From: Tomas Kral Date: Mon, 20 Jul 2026 12:06:22 +0200 Subject: [PATCH 3/4] fix(ci): add branch dist-tag for latest GA and make latest explicit Address PR review feedback: explicitly pass --tag latest for the highest GA branch and add a separate npm dist-tag for the branch name so the package is discoverable via both tags. Assisted-by: Claude Code --- .github/workflows/publish.yaml | 4 ++-- README.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index a6ef7c4..cbd003a 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -61,9 +61,9 @@ jobs: run: | if [ "${{ inputs.branch }}" = "main" ]; then npm publish --access public --tag next - # Check if the selected branch matches the auto-detected latest GA branch (highest semver release-* branch) elif [ "${{ inputs.branch }}" = "${{ steps.detect-ga.outputs.branch }}" ]; then - npm publish --access public + npm publish --access public --tag latest + npm dist-tag add "$(node -p "require('./package.json').name")@$(node -p "require('./package.json').version")" "${{ inputs.branch }}" else npm publish --access public --tag ${{ inputs.branch }} fi diff --git a/README.md b/README.md index 3a9969f..4cf7fb6 100644 --- a/README.md +++ b/README.md @@ -101,7 +101,7 @@ The workflow automatically assigns npm dist-tags based on the selected branch: | Branch | Dist-tag | Example | | --- | --- | --- | | `main` | `next` | `npm install @red-hat-developer-hub/cli@next` | -| Latest GA release branch (auto-detected) | `latest` | `npm install @red-hat-developer-hub/cli@latest` | +| Latest GA release branch (auto-detected) | `latest` + branch name | `npm install @red-hat-developer-hub/cli@latest` or `@release-1.10` | | Older release branches | Branch name (e.g., `release-1.9`) | `npm install @red-hat-developer-hub/cli@release-1.9` | The latest GA branch is auto-detected as the `release-*` branch with the highest semver version. Plugin builders targeting a specific RHDH version should use a semver range (e.g., `~1.10.0`) or the corresponding branch tag rather than `latest`. From deead20055e75651945e5709874324ee28f91ce5 Mon Sep 17 00:00:00 2001 From: Tomas Kral Date: Mon, 20 Jul 2026 17:01:41 +0200 Subject: [PATCH 4/4] fix: format README table to pass prettier check Assisted-by: Claude Code --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 4cf7fb6..8cdd798 100644 --- a/README.md +++ b/README.md @@ -98,11 +98,11 @@ This workflow is **not** currently triggered automatically. It needs to be run m The workflow automatically assigns npm dist-tags based on the selected branch: -| Branch | Dist-tag | Example | -| --- | --- | --- | -| `main` | `next` | `npm install @red-hat-developer-hub/cli@next` | -| Latest GA release branch (auto-detected) | `latest` + branch name | `npm install @red-hat-developer-hub/cli@latest` or `@release-1.10` | -| Older release branches | Branch name (e.g., `release-1.9`) | `npm install @red-hat-developer-hub/cli@release-1.9` | +| Branch | Dist-tag | Example | +| ---------------------------------------- | --------------------------------- | ------------------------------------------------------------------ | +| `main` | `next` | `npm install @red-hat-developer-hub/cli@next` | +| Latest GA release branch (auto-detected) | `latest` + branch name | `npm install @red-hat-developer-hub/cli@latest` or `@release-1.10` | +| Older release branches | Branch name (e.g., `release-1.9`) | `npm install @red-hat-developer-hub/cli@release-1.9` | The latest GA branch is auto-detected as the `release-*` branch with the highest semver version. Plugin builders targeting a specific RHDH version should use a semver range (e.g., `~1.10.0`) or the corresponding branch tag rather than `latest`.