publish.sh 411 B

123456789101112131415
  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. if [ "$TAG" = "tmp" ]; then
  8. # Remove tmp tag
  9. PACKAGE_JSON_NAME="$(tar xfO "$TARBALL" package/package.json | jq -r .name)"
  10. npm dist-tag rm "$PACKAGE_JSON_NAME" "$TAG"
  11. fi