Skip to content

Commit 8f29779

Browse files
authored
Merge pull request #83 from lando/feature/promote-edge-on-edit
feat: promote npm edge tag to latest when prerelease is promoted
2 parents a975300 + abd81f5 commit 8f29779

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

.github/workflows/release.yml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,32 @@ on:
44
release:
55
types:
66
- published
7-
7+
- released
88
jobs:
9+
# When a prerelease is promoted to a full release, update the npm latest tag
10+
promote:
11+
if: github.event.action == 'released'
12+
runs-on: ubuntu-24.04
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v6
16+
- name: Install node 20
17+
uses: actions/setup-node@v6
18+
with:
19+
node-version: '20'
20+
registry-url: https://registry.npmjs.org
21+
- name: Promote edge to latest
22+
run: |
23+
VERSION=$(echo "$TAG_NAME" | sed 's/^v//')
24+
PACKAGE=$(node -p "require('./package.json').name")
25+
npm dist-tag add "$PACKAGE@$VERSION" latest
26+
echo "::notice title=Promoted $VERSION to latest::The latest tag now points to $VERSION (was edge-only)"
27+
env:
28+
TAG_NAME: ${{ github.event.release.tag_name }}
29+
NODE_AUTH_TOKEN: ${{secrets.NPM_DEPLOY_TOKEN}}
30+
931
deploy:
32+
if: github.event.action == 'published'
1033
runs-on: ${{ matrix.os }}
1134
env:
1235
TERM: xterm

0 commit comments

Comments
 (0)