diff --git a/scripts/postversion.sh b/scripts/postversion.sh index f5b4c7173..6e947363b 100755 --- a/scripts/postversion.sh +++ b/scripts/postversion.sh @@ -1,17 +1,22 @@ #!/bin/bash set -e PACKAGE_VERSION=$(node -p -e "require('./package.json').version") -ARCHIVE_BRANCH="releases" +ARCHIVE_BRANCH=${ARCHIVE_BRANCH:-releases} SOURCE_BRANCH=$(git rev-parse --abbrev-ref HEAD) echo 'postversion tasks' # npm publish will generate the pkg/sinon.js that we use below echo 'publish to npm' -git push --follow-tags -npm publish +if [ -n "$DRY_RUN" ]; then + npm publish --dry-run +else + git push --follow-tags + npm publish +fi # Now update the releases branch and archive the new release +echo "archiving release from $SOURCE_BRANCH to $ARCHIVE_BRANCH" git checkout $ARCHIVE_BRANCH git merge --no-edit -m "Merge version $PACKAGE_VERSION" $SOURCE_BRANCH @@ -27,5 +32,5 @@ cp "pkg/sinon.js" "./docs/releases/sinon-$PACKAGE_VERSION.js" git add "docs/releases/sinon-$PACKAGE_VERSION.js" git commit -n -m "Add version $PACKAGE_VERSION to releases" -git push +[ -n "$DRY_RUN" ] || git push git checkout $SOURCE_BRANCH