Skip to content

Commit 3fbf1dd

Browse files
committed
ci(release): clean latest tag after prerelease publish
1 parent 924c316 commit 3fbf1dd

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

.github/workflows/prerelease.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
PACKAGE_VERSION: ${{ inputs.version_base }}-${{ inputs.tag }}.${{ github.run_number }}
5555
run: |
5656
node -e "const fs = require('node:fs'); const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8')); pkg.version = process.env.PACKAGE_VERSION; fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n');"
57-
node -e "const pkg = require('./package.json'); console.log(`${pkg.name}@${pkg.version}`);"
57+
node -e "const pkg = require('./package.json'); console.log(pkg.name + '@' + pkg.version);"
5858
5959
- name: Build package
6060
run: |
@@ -66,3 +66,12 @@ jobs:
6666
env:
6767
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
6868
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
69+
70+
- name: Remove stable latest tag from prerelease
71+
if: inputs.tag != 'latest'
72+
run: |
73+
PACKAGE_NAME=$(node -p "require('./package.json').name")
74+
npm dist-tag rm "$PACKAGE_NAME" latest || true
75+
env:
76+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
77+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)