publish.sh 474 B

1234567891011121314151617181920
  1. #!/usr/bin/env bash
  2. set -euo pipefail
  3. # Intentionally escape $ to avoid interpolation and writing the token to disk
  4. echo "//registry.npmjs.org/:_authToken=\${NPM_TOKEN}" > .npmrc
  5. # Actual publish
  6. npm publish "$TARBALL" --tag "$TAG"
  7. delete_tag() {
  8. PACKAGE_JSON_NAME="$(tar xfO "$TARBALL" package/package.json | jq -r .name)"
  9. npm dist-tag rm "$PACKAGE_JSON_NAME" "$1"
  10. }
  11. if [ "$TAG" = tmp ]; then
  12. delete_tag "$TAG"
  13. elif ["$TAG" = latest ]; then
  14. delete_tag next
  15. fi