Skip to content

chore(release): v0.3.1#10

Merged
code-crusher merged 2 commits into
mainfrom
release/v0.3.1
Jun 23, 2026
Merged

chore(release): v0.3.1#10
code-crusher merged 2 commits into
mainfrom
release/v0.3.1

Conversation

@code-crusher

@code-crusher code-crusher commented Jun 23, 2026

Copy link
Copy Markdown
Member

Bump version to 0.3.1, give the release workflow a 'Release vX.Y.Z' run-name, and make merging a release/vX.Y.Z PR into main auto-publish to npm + create the GitHub Release. No more 'git tag && git push tag' step.

What you do now: open a PR from release/vX.Y.Z and merge it. The workflow:

  1. Verifies the branch version matches package.json (errors out otherwise).
  2. Skips if v0.3.1 is already on npm.
  3. Publishes to npm and creates the v0.3.1 GitHub Release. The release step pushes the tag as a side effect; the subsequent tag-triggered run sees the version is already live and exits cleanly, so there is no loop.

Triggers kept: tag pushes to main and manual workflow_dispatch still work as escape hatches / re-publish paths.

Triggers ignored: PR pushes to a release/v* branch, force-pushes, and merges of any other branch (enforced by the job-level if).

- Add 'Release vX.Y.Z' run-name to the release workflow so manual
  dispatches and tag pushes are easy to tell apart in the Actions list.
- Add CHANGELOG entry.
@matterai-app

matterai-app Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Code Quality new feature

Summary By MatterAI MatterAI logo

🔄 What Changed

Updated the package version to 0.3.1 and significantly enhanced the release workflow. Key updates include a dynamic run-name for CI/CD traceability and new logic to support automated publishing when release/v* branches are merged into main.

🔍 Impact of the Change

Improves release visibility and flexibility. Engineers can now trigger releases via standard PR flows or manual tags, with built-in safeguards ensuring the branch name and package.json version are perfectly synchronized before publishing to NPM.

📁 Total Files Changed

Click to Expand
File ChangeLog
Workflow Automation .github/workflows/release.yml Implemented dynamic run-name and PR merge release logic with strict version validation.
Version Bump package.json Incremented version from 0.3.0 to 0.3.1.

🧪 Test Added/Recommended

Recommended

  • Integration Test: Verify the workflow correctly fails if a release/v0.3.2 branch is merged but package.json still reflects 0.3.1.
  • Dry-Run Validation: Perform a manual workflow_dispatch with the version input to ensure the run-name formats correctly.

🔒 Security Vulnerabilities

No security vulnerabilities detected. 🛡️

⏳ Estimated code review effort

LOW (~10 minutes)

Tip

Quality Recommendations

  1. Consider adding a 'dry-run' flag to the workflow_dispatch to allow testing the workflow logic without actually publishing to NPM.

  2. Ensure the NPM_TOKEN has the minimum required permissions (Automation level) to follow the principle of least privilege.

♫ Tanka Poem

Code flows to the main, 🚀
Version tags and branch names match, 🏷️
Release starts its flight. ✈️
Automation guards the gate, 🛡️
NPM receives the gift. 🎁

Sequence Diagram

sequenceDiagram
    participant D as Developer
    participant G as GitHub Actions
    participant P as package.json
    participant N as NPM Registry

    Note over G: Trigger: PR Merge or Tag Push

    G->>P: Read PKG_VERSION
    
    alt Event is Pull Request
        G->>G: Extract version from branch name (release/v*)
        Note over G: Validate Branch Version == PKG_VERSION
    else Event is Tag Push
        G->>G: Extract version from tag (v*)
        Note over G: Validate Tag Version == PKG_VERSION
    end

    alt Validation Success
        G->>N: npm publish
        N-->>G: 200 Success
        G->>G: Create GitHub Release
    else Validation Failure
        G-->>D: Error: Version Mismatch
    end
Loading

@matterai-app matterai-app Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧪 PR Review is completed: Version bump to 0.3.1 plus a new dynamic run-name for the release workflow. The run-name expression has a logic bug where the 'manual' fallback is unreachable when inputs.version is empty.

Skipped files
  • CHANGELOG.md: Skipped file pattern

Comment thread .github/workflows/release.yml Outdated
# either "Release v<inputs.version>" (when supplied) or "Release manual".
# `run-name` only sees github.* and inputs.* — package.json can't be read here,
# so the dispatch flow relies on the `version` input to show the tag.
run-name: "Release ${{ github.event_name == 'push' && github.ref_name || format('v{0}', inputs.version) || 'manual' }}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟠 Logic Error

Issue: The run-name expression's || 'manual' fallback is unreachable. When inputs.version is empty (not supplied on manual dispatch), format('v{0}', inputs.version) evaluates to "v" — a non-empty, truthy string. This means the || 'manual' branch never fires, and the run name will display "Release v" instead of the intended "Release manual".

Fix: Guard the format() call with a truthiness check on inputs.version so that an empty input falls through to the 'manual' fallback.

Impact: Ensures the workflow run name is correct and meaningful for manual dispatches without a version input.

Suggested change
run-name: "Release ${{ github.event_name == 'push' && github.ref_name || format('v{0}', inputs.version) || 'manual' }}"
run-name: "Release ${{ github.event_name == 'push' && github.ref_name || (inputs.version && format('v{0}', inputs.version)) || 'manual' }}"

Drop the manual 'git tag && git push tag' step from the release flow.
When a release/vX.Y.Z branch is merged into main, this workflow now:

  1. Verifies the branch version matches package.json.
  2. Publishes to npm (skipped if the version is already live).
  3. Creates the vX.Y.Z GitHub release (which pushes the tag as a
     side effect; the subsequent tag-triggered run is short-circuited
     by the 'already on npm' check, so there is no loop).

The tag-push and workflow_dispatch triggers are kept as escape hatches.
@matterai-app

matterai-app Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

✅ Reviewed the changes: Reviewed .github/workflows/release.yml: The release workflow changes are well-structured — the run-name expression, job if-condition, and version resolution logic for all three trigger paths (tag push, PR merge, manual dispatch) are correct. No new issues found.

@code-crusher code-crusher merged commit 18b8801 into main Jun 23, 2026
1 check passed
@code-crusher code-crusher deleted the release/v0.3.1 branch June 23, 2026 19:31
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