Skip to content

Instantly share code, notes, and snippets.

@gordlea
Last active September 9, 2019 18:49
Show Gist options
  • Save gordlea/07b2c3e2dc789bca2504 to your computer and use it in GitHub Desktop.
Save gordlea/07b2c3e2dc789bca2504 to your computer and use it in GitHub Desktop.
Jenkins NPM Publish
#!/bin/sh
echo `env`
echo `ls`
git fetch --tags
git checkout master
git pull origin master
git branch release-$PROMOTED_GIT_COMMIT $PROMOTED_GIT_COMMIT
git clean -f
case $INCREMENT_VERSION in
skip)
echo "Skipping version increment"
;;
*)
echo "Incrementing $INCREMENT_VERSION"
npm version $INCREMENT_VERSION -m "Release %s"
git checkout master
git pull
git merge --no-ff release-$PROMOTED_GIT_COMMIT -m "Merging release branch"
git push origin master --tags
;;
esac
if [ $PUBLISH_TO_NPM = true ]; then
if [ $FORCE_PUBLISH_OVER_EXISTING = true ]; then
npm unpublish --force ./
fi
npm publish ./
export NPM_PACKAGE_VERSION=`cat package.json | grep version | awk -F\" '{ print $4 }'`
fi
print(Jenkins.instance.getJobNames())
//Jenkins.instance.getItemByFullName("identity-lens/identity-lens-pr").getBuildByNumber(146).finish(hudson.model.Result.ABORTED, new java.io.IOException("Aborting build"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment