ci: harden release automation - #8
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR hardens the npm publish workflow by adding a controlled release/npm-v* branch trigger, enforcing release-version verification, and (for branch-triggered releases) creating the tag + GitHub Release from the tested main commit and cleaning up the one-shot branch.
Changes:
- Add
release/npm-v*branch trigger and resolve whether the run is tag-based or release-branch-based, checking outmainfor release-branch runs. - Add release-version verification against
package.jsonand a remote-tag existence guard. - After successful release-branch publish, create an annotated tag + GitHub Release and delete the one-shot release branch.
Suppressed comments (1)
.github/workflows/publish-npm.yml:86
- This step pushes a v* tag, which will re-trigger this same workflow via
on.push.tags: v*. Because the release-branch run already published to npm, the follow-up tag run will attempt to publish the same version again (typically failing and leaving a noisy red workflow). Consider skippingnpm publishwhen the tag push actor isgithub-actions[bot]so tags created by the workflow don't republish.
git tag -a "$TAG" "$COMMIT_SHA" -m "Release $TAG"
git push origin "$TAG"
zip -r opencode-loop.zip . -x ".git/*" "node_modules/*" "opencode-loop.zip"
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+59
to
+63
| test "$RELEASE_VERSION" = "$PACKAGE_VERSION" | ||
| if git ls-remote --exit-code --tags origin "refs/tags/v$RELEASE_VERSION" >/dev/null 2>&1; then | ||
| echo "Tag v$RELEASE_VERSION already exists." >&2 | ||
| exit 1 | ||
| fi |
Comment on lines
10
to
12
| permissions: | ||
| contents: read | ||
| contents: write | ||
| id-token: write |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
v*tag publishing.release/npm-v*branch trigger for environments that cannot create Git tags directly.mainfor release-branch runs, never from branch contents.npm ci, syntax checks, the full test suite, andnpm pack --dry-runbefore publish.maincommit and clean up the one-shot branch.This keeps the existing tag workflow while making releases reproducible and safe to trigger without a direct tag API.