Publish npm packages and create GitHub releases. Use this skill when the user wants to release, publish to npm, create a new version, cut a release, or ship packages. Triggers on phrases like "publish", "release", "npm に出して", "リリースして", "バージョン上げて", "ship it". Also use when the user mentions version bumping in the context of publishing.
Publish packages to npm via the GitHub Actions publish workflow, then create a GitHub release at the resulting tag.
When invoked as /release, arguments follow the skill name:
<version>: Required. patch, minor, major, or an exact semver like 0.3.0--dry-run: Optional. Runs the publish workflow in dry-run mode (no actual publish or release)When auto-triggered from conversation, ask the user for the version if not specified.
gh workflow run publish.yml -f "version=<version>" -f "dry-run=<true|false>"
Wait a few seconds for GitHub to register the run, then find it and watch for completion:
sleep 5
RUN_ID=$(gh run list --workflow=publish.yml --limit=1 --json databaseId --jq '.[0].databaseId')
gh run watch "$RUN_ID"
CONCLUSION=$(gh run view "$RUN_ID" --json conclusion --jq '.conclusion')
If the run failed, show the error:
gh run view "$RUN_ID" --log-failed 2>&1 | tail -30
Report the failure with a link to the run and stop.
Report that the dry-run succeeded and no packages were published.
On success, fetch the tags that lerna created and make a release:
git fetch --tags
# lerna independent mode creates tags like @tainakanchu/[email protected]
# Use the most recent tag as the release tag
TAG=$(git tag --sort=-creatordate | head -1)
gh release create "$TAG" --generate-notes --title "$TAG"
Report the release URL to the user.
NPM_PUBLISH_TOKEN must be set in GitHub repository secrets (Granular Access Token, not Classic)gh CLI must be authenticated with push accessgh workflow run fails: check if the workflow file exists and if the user is authenticated