1
1
mirror of https://github.com/primer/css.git synced 2024-11-30 11:17:05 +03:00
css/script/release-candidate

66 lines
1.9 KiB
Plaintext
Raw Normal View History

2017-07-14 02:11:38 +03:00
#!/bin/bash
set -e
echo "👌 Publishing release candidate..."
2017-07-21 00:33:14 +03:00
PATH=$(npm bin):$PATH
package=primer-css
npm_tag=rc
log=/tmp/rc.log
# get the version we're publishing as a release candidate
local_version=$(jq -r .version modules/$package/package.json)
if [[ $local_version =~ "-" ]]; then
echo "❌ Found pre-release version: $package@$local_version; bailing!"
exit 1
else
echo "🏔 Local version: $package@$local_version"
fi
# get the version most recently published to the rc dist-tag
rc_version=$(npm info $package@$npm_tag version)
echo "📦 Published version for $package@$npm_tag: $rc_version"
rc_release=${rc_version%-*}
2017-07-25 01:48:46 +03:00
if [[ $local_version != $rc_release ]]; then
rc_version=$local_version
fi
2017-07-21 00:33:14 +03:00
# determine the
next_version=$(
semver --increment prerelease --preid $npm_tag $rc_version
)
echo "🤜 Next version: $package@$next_version"
2017-07-21 00:33:14 +03:00
# strip the pre-release version, yielding just major.minor.patch
pre_version=${next_version:${#local_version}}
echo " Prerelease suffix: '$pre_version'"
2017-07-21 00:33:14 +03:00
# if this is the same version, we need to bump the prerelease
# for all of the modules using the same prerelease identifier
echo "Updating all module versions in place..."
echo
2017-07-21 03:42:23 +03:00
module_dirs=modules/primer-*
for module_dir in $module_dirs; do
pushd $module_dir > /dev/null
module=$(basename $module_dir)
2017-07-21 00:33:14 +03:00
# determine the local version (in git)
module_version=$(jq -r .version package.json)
2017-07-25 01:48:46 +03:00
# strip the rc version, just in case
module_version=${module_version%-*}
2017-07-21 00:33:14 +03:00
module_next_version="$module_version$pre_version"
echo "$module@$module_version => $module_next_version"
# "upgrade" to the most recent RC version so that
# `npm version prerelease` can increment automatically
2017-07-25 01:48:46 +03:00
npm version --no-git --quiet "$module_next_version" >> $log
2017-07-21 00:33:14 +03:00
popd > /dev/null
done
# publish all the things!
script/notify pending
# note: this should NOT fail, so --bail=true applies
2017-07-25 22:56:40 +03:00
lerna exec -- npm publish --tag=$npm_tag
script/notify success