mirror of
https://github.com/primer/css.git
synced 2024-11-24 13:15:00 +03:00
65 lines
1.9 KiB
Bash
Executable File
65 lines
1.9 KiB
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
echo "👌 Publishing release candidate..."
|
|
|
|
package=primer-css
|
|
npm_tag=rc
|
|
|
|
# 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%-*}
|
|
if [[ $local_version != $rc_release ]]; then
|
|
rc_version=$local_version
|
|
fi
|
|
|
|
# determine the
|
|
next_version=$(
|
|
$(npm bin)/semver --increment prerelease --preid $npm_tag $rc_version
|
|
)
|
|
echo "🤜 Next version: $package@$next_version"
|
|
|
|
# strip the pre-release version, yielding just major.minor.patch
|
|
pre_version=${next_version:${#local_version}}
|
|
echo " Prerelease suffix: '$pre_version'"
|
|
|
|
# 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
|
|
module_dirs=modules/primer-*
|
|
for module_dir in $module_dirs; do
|
|
pushd $module_dir > /dev/null
|
|
module=$(basename $module_dir)
|
|
|
|
# determine the local version (in git)
|
|
module_version=$(jq -r .version package.json)
|
|
# strip the rc version, just in case
|
|
module_version=${module_version%-*}
|
|
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
|
|
npm version --no-git --quiet "$module_next_version"
|
|
|
|
popd > /dev/null
|
|
done
|
|
|
|
# publish all the things!
|
|
$(dirname $0)/notify pending
|
|
|
|
# note: this should NOT fail, so --bail=true applies
|
|
$(npm bin)/lerna exec -- npm publish --tag=$npm_tag
|
|
|
|
$(dirname $0)/notify success
|