release.sh in percy-common-3.1.2 vs release.sh in percy-common-3.1.3

- old
+ new

@@ -17,11 +17,13 @@ rm "$CURDIR/"percy-common*.gem >/dev/null 2>&1 || true delete_existing_version() { git tag -d "v$1" || true git push origin ":v$1" || true - gem yank percy-common -v "$1" || true + # Replace - with .pre. in version string for rubygems compatibility + GEM_VERSION=${1/-/.pre.} + gem yank percy-common -v "$GEM_VERSION" || true } if [[ $1 =~ ^.*delete$ ]]; then shift echo "Preparing to delete $1" @@ -33,33 +35,40 @@ echo $? ) if [[ "$CLEAN" == "0" ]]; then if [[ $1 == '--force' ]]; then shift - if [[ -n $1 ]]; then - echo "Deleting version $1" + VERSION=$1 + if [[ -n $VERSION ]]; then + echo "Deleting version $VERSION" sleep 1 - delete_existing_version "$1" + delete_existing_version "$VERSION" else echo "Missing release version" exit 1 fi fi VERSION=$1 - echo "Releasing $VERSION" + # Replace - with .pre. in version string for rubygems compatibility + GEM_VERSION="${VERSION/-/.pre.}" + if [[ "$GEM_VERSION" == "$VERSION" ]]; then + echo "Releasing $VERSION" + else + echo "Releasing $VERSION as $GEM_VERSION" + fi sleep 1 sed -i "" -e "s/$PERCY_COMMON_VERSION/$VERSION/g" "lib/percy/common/version.rb" git add "lib/percy/common/version.rb" git commit -a -m "Release $VERSION" || true git tag -a "v$VERSION" -m "$1" || true git push origin "v$VERSION" || true bundle exec rake build - gem push "$CURDIR/pkg/percy-common-"*.gem + gem push "$CURDIR/pkg/percy-common-$GEM_VERSION.gem" open "https://github.com/percy/percy-common/releases/new?tag=v$VERSION&title=$VERSION" - rm "$CURDIR/pkg/percy-common-"*.gem + rm "$CURDIR/pkg/percy-common-$GEM_VERSION.gem" else echo "Please commit your changes and try again" exit 1 fi fi