feat: promote npm edge tag to latest on release edit#229
Merged
AaronFeledy merged 3 commits intomainfrom Feb 20, 2026
Merged
Conversation
✅ Deploy Preview for lando-php ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Adds an 'edited' trigger to the release workflow with a lightweight 'promote' job that runs npm dist-tag to move 'latest' to the current version. Only fires when a prerelease is changed to a full release (not drafts). The existing publish pipeline remains gated to 'published' events only.
740d0a9 to
37fa101
Compare
This comment has been minimized.
This comment has been minimized.
package.json on main may not reflect the released version since prepare-release-action only runs in the deploy job. Using github.event.release.tag_name is more reliable.
|
Bugbot Autofix prepared fixes for 2 of the 2 bugs found in the latest run.
Or push these changes by commenting: Preview (a8e3c05386)diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -9,7 +9,7 @@
jobs:
# When a prerelease is edited to a full release, just promote the npm tag
promote:
- if: github.event.action == 'edited' && !github.event.release.prerelease && !github.event.release.draft
+ if: github.event.action == 'edited' && !github.event.release.prerelease && !github.event.release.draft && github.event.changes.prerelease.from == true
runs-on: ubuntu-24.04
steps:
- name: Checkout code
@@ -21,11 +21,12 @@
registry-url: https://registry.npmjs.org
- name: Promote edge to latest
run: |
- VERSION=$(echo "${{ github.event.release.tag_name }}" | sed 's/^v//')
+ VERSION=$(echo "$TAG_NAME" | sed 's/^v//')
PACKAGE=$(node -p "require('./package.json').name")
npm dist-tag add "$PACKAGE@$VERSION" latest
echo "::notice title=Promoted $VERSION to latest::The latest tag now points to $VERSION (was edge-only)"
env:
+ TAG_NAME: ${{ github.event.release.tag_name }}
NODE_AUTH_TOKEN: ${{secrets.NPM_DEPLOY_TOKEN}}
deploy: |
- Move tag_name to env var to prevent shell injection via crafted tags - Only promote when prerelease status actually changed (changes.prerelease.from == true)
This was referenced Feb 20, 2026
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.


Problem
When a release is published as a prerelease, it gets tagged as
edgeon npm. Later, when the release is edited in GitHub to mark it as a full release, the npmlatesttag doesn't update because the workflow only triggered onpublished.Solution
editedto the release workflow trigger typespromotejob that only runsnpm dist-tag add latest— no install, no lint, no tests, no re-publishedited+ not a prerelease + not a draftdeployjob is now explicitly gated topublishedevents only (no behavior change)Flow
edgetag (unchanged)promotejob runs, pointslatestto that version (~15s)The
dist-tag addcommand is idempotent, so editing a non-prerelease release description is harmless.Note
Low Risk
CI-only change that adjusts npm dist-tags based on GitHub release edits; limited blast radius but could mis-tag
latestif the event gating/conditions are incorrect.Overview
Updates the release workflow to also trigger on
release.editedevents.Adds a new
promotejob that runs only when a prerelease flag is turned off (and release is not draft), and updates npm by promoting the edited release version to thelatestdist-tag vianpm dist-tag add.Explicitly gates the existing
deployjob torelease.publishedevents to avoid running the full publish/test pipeline on edits.Written by Cursor Bugbot for commit e29e7b9. This will update automatically on new commits. Configure here.