1
1
mirror of https://github.com/primer/css.git synced 2024-12-24 14:42:26 +03:00
css/script/bump-rc

46 lines
1.1 KiB
Plaintext
Raw Normal View History

2017-09-23 01:43:44 +03:00
#!/bin/bash
set -e
package="$1"
npm_tag=rc
semver=$(npm bin)/semver
2017-09-23 02:02:38 +03:00
bold=$(tput bold)
normal=$(tput sgr0)
2017-09-23 01:43:44 +03:00
pushd modules/$package > /dev/null
# get the version we're publishing as a release candidate
local_version=$(jq -r .version package.json)
2017-09-23 02:02:38 +03:00
echo "Bumping $package@${local_version}"
2017-09-23 01:43:44 +03:00
if [[ $local_version =~ "-" ]]; then
echo "❌ Found pre-release version: $package@$local_version; bailing!"
exit 1
fi
# find the *greatest* published prerelease
rc_prefix="$local_version-rc"
rc_version=$(
npm info "$package@$npm_tag" --json \
| jq -r '.versions[]' \
| grep "^${rc_prefix/./\.}" \
| sort -r \
| head -1
)
# if there isn't one, use the current local version
if [[ "$rc_version" == "" ]]; then
2017-09-23 02:02:38 +03:00
echo " 🤷‍♀️ no published RC; using ${bold}${local_version}${normal}"
2017-09-23 01:43:44 +03:00
rc_version=$local_version
2017-09-23 02:02:38 +03:00
else
echo " 📰 published RC: ${bold}${rc_version}${normal}"
2017-09-23 01:43:44 +03:00
fi
# increment by the tagged prerelease id
next_version=$(
2017-09-23 02:02:38 +03:00
$semver -i prerelease --preid $npm_tag "$rc_version"
2017-09-23 01:43:44 +03:00
)
2017-09-23 02:02:38 +03:00
bumped=$(npm version --no-git "$next_version")
echo " ➡️ ${bold}${bumped}${normal}"
2017-09-23 01:43:44 +03:00
popd > /dev/null