Skip to content

fix(release): publish GitHub releases for stable versions only#3818

Closed
caio-pizzol wants to merge 2 commits into
mainfrom
fix/stable-only-github-releases
Closed

fix(release): publish GitHub releases for stable versions only#3818
caio-pizzol wants to merge 2 commits into
mainfrom
fix/stable-only-github-releases

Conversation

@caio-pizzol

Copy link
Copy Markdown
Contributor

Keeps the GitHub Releases page focused on stable package history by omitting the GitHub publishing plugin from next releases. Version calculation and prerelease distribution continue through Git tags and package registry dist-tags without creating a public release entry for every merge.

  • preserves prerelease Git tags and npm next publishing
  • keeps stable release notes, comments, and assets unchanged
  • stops packaging prerelease VS Code .vsix files that had no destination outside GitHub Releases
  • links Linear prerelease breadcrumbs to Git tags instead of missing Release pages

@caio-pizzol caio-pizzol marked this pull request as ready for review July 13, 2026 20:12
@caio-pizzol caio-pizzol requested a review from a team as a code owner July 13, 2026 20:12
@qodo-code-review

qodo-code-review Bot commented Jul 13, 2026

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Env-only prerelease detection ✓ Resolved 🐞 Bug ☼ Reliability
Description
The release configs infer isPrerelease only from `process.env.GITHUB_REF_NAME ||
process.env.CI_COMMIT_BRANCH; when these are unset, branch becomes undefined, isPrerelease`
becomes false, and shouldPublishGitHubRelease becomes true—re-enabling @semantic-release/github
and publishing GitHub Releases even for prerelease runs. This undermines the PR’s “stable-only
GitHub Releases” guarantee outside the exact CI environment assumptions (e.g., manual
semantic-release runs or misconfigured workflows).
Code

apps/cli/.releaserc.cjs[R33-38]

const isPrerelease = branches.some((b) => typeof b === 'object' && b.name === branch && b.prerelease);

-// stable -> main syncs (real merges) re-attribute prereleases to PRs already shipped on @latest.
-// Gate per-PR/issue success comments off on prereleases to avoid duplicate "shipped" comments.
-const shouldCommentOnRelease = !isPrerelease;
-// Linear release comments are the shipped-version breadcrumb inside Linear
-// itself, so keep them on for prereleases even while GitHub PR comments stay
-// gated separately.
+// GitHub Releases are stable-only; prerelease tags and package publishing still proceed.
+const shouldPublishGitHubRelease = !isPrerelease;
+// Linear release comments remain the shipped-version breadcrumb, so
Relevance

⭐⭐⭐ High

PR #2489 explicitly fixed missing GITHUB_REF_NAME making isPrerelease false locally; team addresses
env-dependent release misbehavior.

PR-#2489
PR-#3337

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The .releaserc.cjs files use CI env vars to determine prerelease state; when unset, isPrerelease
is false and the new stable-only GitHub publishing gate will incorrectly allow GitHub releases. The
repo’s local release runner explicitly documents this failure mode (missing GITHUB_REF_NAME makes
isPrerelease always false locally).

apps/cli/.releaserc.cjs[27-40]
apps/cli/.releaserc.cjs[90-98]
scripts/release-local.mjs[20-26]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`isPrerelease` (and therefore `shouldPublishGitHubRelease`) is derived from CI-only env vars. If `GITHUB_REF_NAME`/`CI_COMMIT_BRANCH` are missing, the code treats the branch as non-prerelease and publishes GitHub Releases, contradicting the new stable-only policy.

## Issue Context
This repo already documents that missing `GITHUB_REF_NAME` makes prerelease detection incorrect in local runs.

## Fix Focus Areas
- Add a safe fallback for `branch` when env vars are missing (e.g., `git rev-parse --abbrev-ref HEAD`), or fail-closed by requiring a known branch before enabling GitHub publication.
- Apply consistently across all `.releaserc.cjs` files that compute `branch` the same way.

### Recommended code change shape
- In each `.releaserc.cjs`:
 - Replace `const branch = process.env.GITHUB_REF_NAME || process.env.CI_COMMIT_BRANCH;`
 - With something like:
   - `const branch = process.env.GITHUB_REF_NAME || process.env.CI_COMMIT_BRANCH || execFileSync('git', ['rev-parse','--abbrev-ref','HEAD'], { encoding: 'utf8' }).trim();`

## Fix Focus Areas (paths/lines)
- apps/cli/.releaserc.cjs[27-40]
- scripts/release-local.mjs[20-26]
- apps/create/.releaserc.cjs[7-18]
- packages/fonts/.releaserc.cjs[9-20]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Previous review results

Review updated until commit b6ba3b3

Results up to commit 204b14d


🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)


Remediation recommended
1. Env-only prerelease detection ✓ Resolved 🐞 Bug ☼ Reliability
Description
The release configs infer isPrerelease only from `process.env.GITHUB_REF_NAME ||
process.env.CI_COMMIT_BRANCH; when these are unset, branch becomes undefined, isPrerelease`
becomes false, and shouldPublishGitHubRelease becomes true—re-enabling @semantic-release/github
and publishing GitHub Releases even for prerelease runs. This undermines the PR’s “stable-only
GitHub Releases” guarantee outside the exact CI environment assumptions (e.g., manual
semantic-release runs or misconfigured workflows).
Code

apps/cli/.releaserc.cjs[R33-38]

const isPrerelease = branches.some((b) => typeof b === 'object' && b.name === branch && b.prerelease);

-// stable -> main syncs (real merges) re-attribute prereleases to PRs already shipped on @latest.
-// Gate per-PR/issue success comments off on prereleases to avoid duplicate "shipped" comments.
-const shouldCommentOnRelease = !isPrerelease;
-// Linear release comments are the shipped-version breadcrumb inside Linear
-// itself, so keep them on for prereleases even while GitHub PR comments stay
-// gated separately.
+// GitHub Releases are stable-only; prerelease tags and package publishing still proceed.
+const shouldPublishGitHubRelease = !isPrerelease;
+// Linear release comments remain the shipped-version breadcrumb, so
Relevance

⭐⭐⭐ High

PR #2489 explicitly fixed missing GITHUB_REF_NAME making isPrerelease false locally; team addresses
env-dependent release misbehavior.

PR-#2489
PR-#3337

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The .releaserc.cjs files use CI env vars to determine prerelease state; when unset, isPrerelease
is false and the new stable-only GitHub publishing gate will incorrectly allow GitHub releases. The
repo’s local release runner explicitly documents this failure mode (missing GITHUB_REF_NAME makes
isPrerelease always false locally).

apps/cli/.releaserc.cjs[27-40]
apps/cli/.releaserc.cjs[90-98]
scripts/release-local.mjs[20-26]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`isPrerelease` (and therefore `shouldPublishGitHubRelease`) is derived from CI-only env vars. If `GITHUB_REF_NAME`/`CI_COMMIT_BRANCH` are missing, the code treats the branch as non-prerelease and publishes GitHub Releases, contradicting the new stable-only policy.

## Issue Context
This repo already documents that missing `GITHUB_REF_NAME` makes prerelease detection incorrect in local runs.

## Fix Focus Areas
- Add a safe fallback for `branch` when env vars are missing (e.g., `git rev-parse --abbrev-ref HEAD`), or fail-closed by requiring a known branch before enabling GitHub publication.
- Apply consistently across all `.releaserc.cjs` files that compute `branch` the same way.

### Recommended code change shape
- In each `.releaserc.cjs`:
 - Replace `const branch = process.env.GITHUB_REF_NAME || process.env.CI_COMMIT_BRANCH;`
 - With something like:
   - `const branch = process.env.GITHUB_REF_NAME || process.env.CI_COMMIT_BRANCH || execFileSync('git', ['rev-parse','--abbrev-ref','HEAD'], { encoding: 'utf8' }).trim();`

## Fix Focus Areas (paths/lines)
- apps/cli/.releaserc.cjs[27-40]
- scripts/release-local.mjs[20-26]
- apps/create/.releaserc.cjs[7-18]
- packages/fonts/.releaserc.cjs[9-20]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Qodo Logo

Comment thread apps/cli/.releaserc.cjs
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@caio-pizzol

Copy link
Copy Markdown
Contributor Author

@qodo-code-review Fixed in b6ba3b3. GitHub publication now fails closed when branch metadata is missing.

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit b6ba3b3

@superdoc-bot

superdoc-bot Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

This pull request landed on main as 027f5fb.

@superdoc-bot superdoc-bot Bot closed this in 027f5fb Jul 14, 2026
@superdoc-bot

superdoc-bot Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

🎉 This PR is included in esign v2.7.3

The release is available on GitHub release

@superdoc-bot

superdoc-bot Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

🎉 This PR is included in template-builder v1.12.2

The release is available on GitHub release

@superdoc-bot

superdoc-bot Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

🎉 This PR is included in superdoc-cli v0.22.0

The release is available on GitHub release

@superdoc-bot

superdoc-bot Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

🎉 This PR is included in superdoc-sdk v1.21.0

@superdoc-bot

superdoc-bot Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

🎉 This PR is included in @superdoc-dev/mcp v0.17.0

The release is available on GitHub release

@superdoc-bot

superdoc-bot Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

🎉 This PR is included in @superdoc-dev/fonts v0.2.0

The release is available on GitHub release

@superdoc-bot

superdoc-bot Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

🎉 This PR is included in superdoc v1.45.0

The release is available on GitHub release

@superdoc-bot

superdoc-bot Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

🎉 This PR is included in @superdoc-dev/react v1.16.0

The release is available on GitHub release

@superdoc-bot

superdoc-bot Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

🎉 This PR is included in vscode-ext v2.17.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants