Skip to content

Instantly share code, notes, and snippets.

@tswaters
Created February 13, 2018 16:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tswaters/34e97c73d30dea6cffc49b6d590e881d to your computer and use it in GitHub Desktop.
Save tswaters/34e97c73d30dea6cffc49b6d590e881d to your computer and use it in GitHub Desktop.
Add tags to git repo based on npm view output
#!/usr/bin/env bash
for version in $(npm view $1 --json | jq '.versions[]' -c -r); do
sha=$(npm view $1@$version --json | jq '.gitHead' -c -r)
echo Tagging $sha as v$version
git tag -a "v$version" $sha -m "Release v$version"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment