File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33set -euo pipefail
44
5+ PACKAGE_JSON_NAME=" $( tar xfO " $TARBALL " package/package.json | jq -r .name) "
6+ PACKAGE_JSON_VERSION=" $( tar xfO " $TARBALL " package/package.json | jq -r .version) "
7+
58# Intentionally escape $ to avoid interpolation and writing the token to disk
69echo " //registry.npmjs.org/:_authToken=\$ {NPM_TOKEN}" > .npmrc
710
811# Actual publish
912npm publish " $TARBALL " --tag " $TAG "
1013
14+ # Clean up tags
1115delete_tag () {
12- PACKAGE_JSON_NAME=" $( tar xfO " $TARBALL " package/package.json | jq -r .name) "
1316 npm dist-tag rm " $PACKAGE_JSON_NAME " " $1 "
1417}
1518
1619if [ " $TAG " = tmp ]; then
1720 delete_tag " $TAG "
1821elif [ " $TAG " = latest ]; then
19- delete_tag next
22+ # Delete the next tag if it exists and is a prerelease for what is currently being published
23+ if npm dist-tag ls " $PACKAGE_JSON_NAME " | grep -q " next: $PACKAGE_JSON_VERSION " ; then
24+ delete_tag next
25+ fi
2026fi
You can’t perform that action at this time.
0 commit comments