Skip to content

Commit f34a3a7

Browse files
Transpile 17c1a3a4
1 parent 3d4c0d5 commit f34a3a7

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

scripts/release/workflow/publish.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,25 @@
22

33
set -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
69
echo "//registry.npmjs.org/:_authToken=\${NPM_TOKEN}" > .npmrc
710

811
# Actual publish
912
npm publish "$TARBALL" --tag "$TAG"
1013

14+
# Clean up tags
1115
delete_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

1619
if [ "$TAG" = tmp ]; then
1720
delete_tag "$TAG"
1821
elif [ "$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
2026
fi

0 commit comments

Comments
 (0)