fix: extract publish logic to dedicated release script#5
Conversation
The changesets action's publish field doesn't properly support multi-line shell scripts. This change extracts the version check and publish logic to a dedicated scripts/release.sh file, improving maintainability and ensuring the workflow executes correctly. Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
|
There was a problem hiding this comment.
Pull request overview
This PR extracts the npm publishing logic from the GitHub Actions workflow into a dedicated bash script to work around a compatibility issue with the changesets action's handling of multi-line shell commands.
Key Changes:
- Created
scripts/release.shcontaining version check and conditional publish logic - Updated workflow to call the script with
bash scripts/release.shinstead of inline multi-line commands
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| scripts/release.sh | New bash script that checks if a version exists on npm before publishing, extracted from the workflow |
| .github/workflows/version.yml | Updated to call the new release script instead of using inline multi-line shell commands |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
Problem
The changesets action's
publishfield doesn't properly support multi-line shell scripts. When a multi-line script is provided, the action attempts to execute only the first line as a command name, causing the workflow to fail.Solution
Created scripts/release.sh to contain the version check and publish logic, and updated version.yml to call it with
bash scripts/release.sh. This approach:🤖 Generated with Claude Code