Skip to content

ci: release action using release-it#426

Merged
Brentlok merged 4 commits intomainfrom
release-it
Mar 3, 2026
Merged

ci: release action using release-it#426
Brentlok merged 4 commits intomainfrom
release-it

Conversation

@Brentlok
Copy link
Contributor

@Brentlok Brentlok commented Mar 3, 2026

Summary by CodeRabbit

  • Chores
    • Consolidated release flow into a single automated release step with simplified permissions and token passthrough
    • Added repository release script and tooling to standardize publishing and versioning
  • New Features
    • Configurable version increments (patch/minor/major) and optional pre-release identifiers
    • Automatic changelog generation to produce consistent release notes and history

@coderabbitai
Copy link

coderabbitai bot commented Mar 3, 2026

📝 Walkthrough

Walkthrough

Consolidates the release flow into a single npx release-it invocation driven by new workflow inputs (increment, pre_release, dry_run). Adds per-package release-it config, git-cliff changelog tooling and scripts, and devDependencies; removes prior multi-step version/publish/release-notes orchestration.

Changes

Cohort / File(s) Summary
Release Workflow Simplification
​.github/workflows/release.yaml
Replaced multi-step release process with one npx release-it step. Added inputs increment and pre_release; removed npm_tag and version. Passes GITHUB_TOKEN to release-it, expanded permissions (issues: write, pull-requests: write), and removed manual release-note/version/publish steps.
Release-It Configuration & Hooks
packages/uniwind/.release-it.json, packages/uniwind/changelog.sh
Added release-it config enabling Git/GitHub releases and npm publish; after:bump hook runs ./changelog.sh. changelog.sh generates changelog via git-cliff, supports stdout vs file write, and reads package version.
Changelog Generator Config & Changelog
packages/uniwind/cliff.toml, packages/uniwind/CHANGELOG.md
Adds git-cliff configuration with templates/groups and a minimal CHANGELOG.md placeholder.
Package JSON & Dev Tooling
packages/uniwind/package.json
Adds release script (release-it) and devDependencies release-it and git-cliff. Minor formatting tweak in scripts.

Sequence Diagram(s)

sequenceDiagram
  participant GH as GitHub Actions
  participant RI as release-it (npx)
  participant CH as changelog.sh / git-cliff
  participant Git as Git Remote (origin)
  participant GH_API as GitHub API
  participant NPM as npm Registry

  GH->>RI: invoke npx release-it (inputs: increment, pre_release, dry_run, GITHUB_TOKEN)
  RI->>CH: run ./changelog.sh (after:bump) to generate notes
  CH->>Git: read tags & commits (git-cliff) and output changelog
  RI->>Git: create commit & tag
  RI->>Git: push commits & tags to origin
  RI->>GH_API: create GitHub Release (uses GITHUB_TOKEN)
  RI->>NPM: publish package (uses npm auth env)
  GH_API-->>GH: release created
  NPM-->>GH: publish result
  Git-->>GH: push result
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I hopped through scripts and TOML bright,

I stitched the notes by starlit night.
One command now hums the release tune,
tags and changelogs beneath the moon.
A rabbit cheers: "Cut the ribbon — boom!" 🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'ci: release action using release-it' clearly and concisely summarizes the main change: replacing the npm_tag/version-based release workflow with a release-it-driven approach.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch release-it

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
packages/uniwind/.release-it.json (1)

7-8: Consider keeping release safety checks enabled by default.

Disabling these checks makes accidental dirty-tree or misconfigured publish runs easier, especially outside CI.

♻️ Safer default config
-        "requireCleanWorkingDir": false,
-        "requireUpstream": false,
+        "requireCleanWorkingDir": true,
+        "requireUpstream": true,
...
-        "skipChecks": true
+        "skipChecks": false

Also applies to: 23-23

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/uniwind/.release-it.json` around lines 7 - 8, The config disables
important release safety checks by setting requireCleanWorkingDir and
requireUpstream to false; re-enable them by setting requireCleanWorkingDir: true
and requireUpstream: true (or remove these overrides so the defaults apply) and,
if CI needs to bypass them, use CI-specific overrides or environment-based flags
instead of changing the repo-defaults; update the keys requireCleanWorkingDir
and requireUpstream in .release-it.json accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/release.yaml:
- Around line 97-98: Remove the NODE_AUTH_TOKEN environment variable from the
release workflow so npm Trusted Publishing via OIDC can work; specifically
delete the NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} entry (leave
GITHUB_TOKEN in place for other GitHub API usage) so the release step (the job
that uses permissions: id-token: write and release-it/--provenance) will use
OIDC token-based auth instead of being forced to token-based auth with
GITHUB_TOKEN.

---

Nitpick comments:
In `@packages/uniwind/.release-it.json`:
- Around line 7-8: The config disables important release safety checks by
setting requireCleanWorkingDir and requireUpstream to false; re-enable them by
setting requireCleanWorkingDir: true and requireUpstream: true (or remove these
overrides so the defaults apply) and, if CI needs to bypass them, use
CI-specific overrides or environment-based flags instead of changing the
repo-defaults; update the keys requireCleanWorkingDir and requireUpstream in
.release-it.json accordingly.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f5db5f5 and 8bf5be4.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (4)
  • .github/workflows/release.yaml
  • packages/uniwind/.release-it.json
  • packages/uniwind/CHANGELOG.md
  • packages/uniwind/package.json

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
.github/workflows/release.yaml (1)

85-95: Consider using an array for more robust argument handling.

Using unquoted $ARGS can cause incorrect argument parsing if pre_release ever contains spaces (though unlikely with typical identifiers like "beta", "rc"). A bash array would be more robust.

♻️ Optional improvement using array-based approach
-          ARGS="--ci $INCREMENT"
+          ARGS=(--ci "$INCREMENT")

           if [ -n "$PRE_RELEASE" ]; then
-            ARGS="$ARGS --preRelease=$PRE_RELEASE"
+            ARGS+=(--preRelease="$PRE_RELEASE")
           fi

           if [ "$DRY_RUN" = "true" ]; then
-            ARGS="$ARGS --dry-run"
+            ARGS+=(--dry-run)
           fi

-          npx release-it $ARGS
+          npx release-it "${ARGS[@]}"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/release.yaml around lines 85 - 95, Replace the string ARGS
with a bash array to avoid word-splitting: initialize an array (e.g., ARGS=(--ci
"$INCREMENT")), append flags conditionally using
ARGS+=(--preRelease="$PRE_RELEASE") and ARGS+=(--dry-run) when appropriate, and
invoke release-it with npx release-it "${ARGS[@]}" so each flag/value is passed
as a separate argument; update references to ARGS in the shown block
accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In @.github/workflows/release.yaml:
- Around line 85-95: Replace the string ARGS with a bash array to avoid
word-splitting: initialize an array (e.g., ARGS=(--ci "$INCREMENT")), append
flags conditionally using ARGS+=(--preRelease="$PRE_RELEASE") and
ARGS+=(--dry-run) when appropriate, and invoke release-it with npx release-it
"${ARGS[@]}" so each flag/value is passed as a separate argument; update
references to ARGS in the shown block accordingly.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8bf5be4 and ca1466a.

📒 Files selected for processing (1)
  • .github/workflows/release.yaml

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
packages/uniwind/changelog.sh (1)

4-12: Make the script path-stable instead of cwd-dependent.

Lines 4, 8, and 12 resolve files relative to the caller's working directory. While the workflow currently mitigates this by setting working-directory: packages/uniwind before invoking release-it, the script itself is fragile. Manual invocation from different directories would read/write files in the wrong locations.

The proposed hardening using SCRIPT_DIR and REPO_ROOT would make the script robust to invocation context.

♻️ Proposed hardening
 #!/usr/bin/env bash
 set -euo pipefail
 
-VERSION=$(node -p "require('./package.json').version")
+SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
+REPO_ROOT="$(git -C "$SCRIPT_DIR" rev-parse --show-toplevel)"
+VERSION="$(node -p "require(process.argv[1]).version" "$SCRIPT_DIR/package.json")"
 INCLUDE_PATH="packages/uniwind/**"
 
+cd "$REPO_ROOT"
+
 if [ "${1:-}" = "stdout" ]; then
-    npx git-cliff --config cliff.toml --include-path "$INCLUDE_PATH" \
+    npx git-cliff --config "$SCRIPT_DIR/cliff.toml" --include-path "$INCLUDE_PATH" \
         --unreleased --tag "$VERSION" --output -
 else
-    npx git-cliff --config cliff.toml --include-path "$INCLUDE_PATH" \
-        --tag "$VERSION" --output CHANGELOG.md
+    npx git-cliff --config "$SCRIPT_DIR/cliff.toml" --include-path "$INCLUDE_PATH" \
+        --tag "$VERSION" --output "$SCRIPT_DIR/CHANGELOG.md"
 fi
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/uniwind/changelog.sh` around lines 4 - 12, The script is
cwd-dependent; make it path-stable by computing SCRIPT_DIR (e.g., dirname of
"$0") and REPO_ROOT (one or two levels up) and use those when reading
package.json and composing INCLUDE_PATH and output paths: change VERSION to read
"$REPO_ROOT/package.json", set INCLUDE_PATH to "$REPO_ROOT/packages/uniwind/**",
and pass resolved paths for --config and --output (use "$REPO_ROOT/cliff.toml"
and write "$REPO_ROOT/packages/uniwind/CHANGELOG.md" when not stdout) so
git-cliff always operates on repository-root–relative files regardless of caller
cwd.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/uniwind/changelog.sh`:
- Around line 8-12: The git-cliff invocations pass the raw VERSION (e.g. 1.2.3)
to the --tag flag causing mismatched metadata; update both git-cliff calls in
changelog.sh (the two npx git-cliff lines) to pass the release tag prefixed with
v (i.e., use "v$VERSION" for --tag) so generated changelog metadata and compare
links match the repository's v${version} tags.

In `@packages/uniwind/cliff.toml`:
- Around line 67-68: Update the skip rule that currently reads "{ message =
"^chore\\(release\\)", skip = true }" so it also matches the "chore: release
v${version}" style commits; replace the regex with one that covers both forms
(for example use a single pattern like "^chore(?:\\(release\\)|: release)" or
equivalent) and keep skip = true so release commits are excluded from the
changelog.

---

Nitpick comments:
In `@packages/uniwind/changelog.sh`:
- Around line 4-12: The script is cwd-dependent; make it path-stable by
computing SCRIPT_DIR (e.g., dirname of "$0") and REPO_ROOT (one or two levels
up) and use those when reading package.json and composing INCLUDE_PATH and
output paths: change VERSION to read "$REPO_ROOT/package.json", set INCLUDE_PATH
to "$REPO_ROOT/packages/uniwind/**", and pass resolved paths for --config and
--output (use "$REPO_ROOT/cliff.toml" and write
"$REPO_ROOT/packages/uniwind/CHANGELOG.md" when not stdout) so git-cliff always
operates on repository-root–relative files regardless of caller cwd.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ca1466a and c8e600d.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (4)
  • packages/uniwind/.release-it.json
  • packages/uniwind/changelog.sh
  • packages/uniwind/cliff.toml
  • packages/uniwind/package.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/uniwind/package.json

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
packages/uniwind/changelog.sh (1)

4-12: Script has a working-directory dependency, but it's currently mitigated by explicit pipeline configuration.

The script relies on relative paths (./package.json, cliff.toml, CHANGELOG.md) that depend on the caller's working directory. However, in the release workflow (release.yaml, line 79), the working directory is explicitly set to packages/uniwind, so the script works as expected in the current pipeline.

That said, the design is fragile: if the working directory configuration changes, or if someone runs the script manually from elsewhere, it will fail. Additionally, line 5 uses a hardcoded repo-relative path (INCLUDE_PATH="packages/uniwind/**") while the script executes from the package directory, creating an inconsistency.

Anchoring paths to the script directory using BASH_SOURCE would make the script more robust and independent of caller context.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/uniwind/changelog.sh` around lines 4 - 12, The script relies on
caller working directory (uses ./package.json, cliff.toml, CHANGELOG.md and
hardcoded INCLUDE_PATH) which is fragile; update the script to compute its
directory via BASH_SOURCE (e.g., SCRIPT_DIR="$(cd "$(dirname
"${BASH_SOURCE[0]}")" && pwd)") and then reference files relative to that
directory when resolving VERSION, cliff.toml, CHANGELOG.md and set INCLUDE_PATH
relative to SCRIPT_DIR (or the repo root computed from SCRIPT_DIR) so the
commands in the block that use VERSION and INCLUDE_PATH work regardless of the
current working directory.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@packages/uniwind/changelog.sh`:
- Around line 4-12: The script relies on caller working directory (uses
./package.json, cliff.toml, CHANGELOG.md and hardcoded INCLUDE_PATH) which is
fragile; update the script to compute its directory via BASH_SOURCE (e.g.,
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)") and then reference
files relative to that directory when resolving VERSION, cliff.toml,
CHANGELOG.md and set INCLUDE_PATH relative to SCRIPT_DIR (or the repo root
computed from SCRIPT_DIR) so the commands in the block that use VERSION and
INCLUDE_PATH work regardless of the current working directory.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c8e600d and dd7bf63.

📒 Files selected for processing (2)
  • packages/uniwind/changelog.sh
  • packages/uniwind/cliff.toml

@Brentlok Brentlok merged commit 17071b3 into main Mar 3, 2026
2 checks passed
@Brentlok Brentlok deleted the release-it branch March 3, 2026 09:23
@github-actions
Copy link
Contributor

github-actions bot commented Mar 5, 2026

🚀 This pull request is included in v1.5.0. See Release v1.5.0 for release notes.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant