Skip to content

ci: add semantic-release workflow ported from @harperfast/vite - #54

Merged
dawsontoth merged 3 commits into
mainfrom
claude/nextjs-release-workflow
Jul 23, 2026
Merged

ci: add semantic-release workflow ported from @harperfast/vite#54
dawsontoth merged 3 commits into
mainfrom
claude/nextjs-release-workflow

Conversation

@dawsontoth

@dawsontoth dawsontoth commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Brings the release automation from the sibling @harperfast/vite plugin into this repo, so merges to main cut versioned releases and publish to npm automatically. Independent of and parallel to #53.

What's added

File Purpose
.github/workflows/release.yaml semantic-release on push to main (+ merge queue / manual dispatch). Publishes to npm with provenance (id-token: write + NPM_CONFIG_PROVENANCE: true), under a Release GitHub environment.
.github/workflows/verify-commits.yaml Lints PR/commit messages with commitlint — the conventional commits semantic-release parses to decide version bumps.
commitlint.config.cjs Conventional-commits rules (verbatim from vite).
.releaserc.json semantic-release plugins: commit-analyzer → release-notes-generator → npm → git → github (verbatim from vite).
package.json Adds prepublishOnly: "npm run build".

Adaptations from vite (otherwise verbatim)

  • Repo guard: if: github.repository == 'HarperFast/nextjs' ....
  • Pre-release gate is npm run build. Vite gates on format:check + test:coverage; neither script exists on nextjs's main yet (adding Prettier tooling would mean reformatting the whole repo — out of scope for a clean release PR). npm run build runs tsc and fails a broken build before it publishes.
  • Action SHAs are pinned exactly as in vite.

Why prepublishOnly is required

dist/ is gitignored, so after npm ci in CI it doesn't exist. The files allowlist publishes dist/**, so @semantic-release/npm (which runs npm publish) must rebuild it first — prepublishOnly does that.

Before this can publish (owner setup — noted, not done here)

  • Create the Release GitHub environment.
  • Configure npm publish auth / OIDC trusted publisher for provenance (you mentioned you'd set this up).
  • Enable the workflows in repo settings if Actions are restricted.

Follow-ups (not blocking)

  • Once fix: serialize next build across worker threads (#52) #53 lands (npm test + unit tests) and/or Prettier tooling is added, the release gate can be extended to match vite (format:check + tests), and vite's verify-pr.yaml CI matrix could be ported too.
  • Existing integration-tests.yml is left untouched (still if: false).

🤖 Generated with Claude Code

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces release and commit linting configurations by adding .releaserc.json and commitlint.config.cjs, and updates package.json with a prepublishOnly script. Feedback suggests adding a publishConfig block to package.json to ensure the scoped package is published publicly, and removing the non-standard feature commit type from .releaserc.json to align with the commitlint rules.

Comment thread package.json
Comment thread .releaserc.json
dawsontoth and others added 2 commits July 23, 2026 10:19
Bring the release automation from the sibling `@harperfast/vite` plugin so
merges to `main` cut versioned releases and publish to npm automatically.

- `.github/workflows/release.yaml` — semantic-release on push to `main`
  (and via merge queue / manual dispatch), publishing to npm with provenance
  (`id-token: write` + `NPM_CONFIG_PROVENANCE`). Runs under a `Release`
  environment. Gated on `npm run build` (`dist/` is gitignored and rebuilt on
  publish via `prepublishOnly`, so this fails a broken build before it ships).
- `.github/workflows/verify-commits.yaml` + `commitlint.config.cjs` — enforce
  the conventional commits that semantic-release parses for version bumps.
- `.releaserc.json` — semantic-release config (commit-analyzer, release notes,
  npm, git, github), matching vite.
- `package.json` — add `prepublishOnly: "npm run build"` so `npm publish`
  (invoked by @semantic-release/npm) compiles `dist/` in CI.

Adapted from vite: the `github.repository` guard targets `HarperFast/nextjs`,
and the pre-release gate is `npm run build` (vite's `format:check` /
`test:coverage` scripts don't exist here yet). Action SHAs are pinned as in
vite.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
`@harperfast/nextjs` is a scoped package, which npm publishes with restricted
access by default — the automated release would fail with 402 Payment Required
on a fresh publish. Add `publishConfig.access = "public"`, matching
`@harperfast/vite` (this was missing from the initial port).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
`feature` is not a valid @commitlint/config-conventional type, so a `feature:`
commit can never pass the Verify Commits workflow — the release-notes-generator
mapping for it is dead config that contradicts our commitlint rules. Drop it and
rely on the standard `feat` type. Mirrors the same cleanup in @harperfast/vite.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@dawsontoth
dawsontoth requested a review from a team July 23, 2026 14:30
@dawsontoth
dawsontoth merged commit 9118989 into main Jul 23, 2026
7 checks passed
@dawsontoth
dawsontoth deleted the claude/nextjs-release-workflow branch July 23, 2026 17:46
@dawsontoth

Copy link
Copy Markdown
Contributor Author

release failed, perfect! I'll open a new PR with a triage. Always great to learn.

@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 2.2.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants