mirror of
https://github.com/primer/css.git
synced 2024-11-13 08:04:16 +03:00
first go at release candidate logic
This commit is contained in:
parent
cce5dea156
commit
e331b63551
@ -1,4 +1,77 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
echo "👌 Publishing release candidate..."
|
||||
echo lerna publish --npm-tag=rc
|
||||
|
||||
PATH=$(npm bin):$PATH
|
||||
|
||||
package=primer-css
|
||||
npm_tag=rc
|
||||
log=/tmp/rc.log
|
||||
|
||||
function bump() {
|
||||
npm version --no-git $@
|
||||
}
|
||||
|
||||
function publish() {
|
||||
npm publish --silent --tag=$npm_tag $@
|
||||
}
|
||||
|
||||
export bump publish
|
||||
|
||||
# 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%-*}
|
||||
|
||||
# determine the
|
||||
next_version=$(
|
||||
semver --increment prerelease --preid $npm_tag $rc_version
|
||||
)
|
||||
echo "🆙 Next version: $package@$next_version"
|
||||
|
||||
# update primer-css to the latest new version
|
||||
pushd modules/$package
|
||||
bump $next_version
|
||||
popd
|
||||
|
||||
# strip the pre-release version, yielding just major.minor.patch
|
||||
pre_version=${next_version:${#local_version}}
|
||||
echo "prerelease suffix: '$pre_version'"
|
||||
|
||||
# get the name of every module
|
||||
modules=$(lerna exec pwd | xargs basename)
|
||||
|
||||
# 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
|
||||
for module in $modules; do
|
||||
if [[ $module = $package ]]; then
|
||||
echo "Skipping $package (already bumped)"
|
||||
continue
|
||||
fi
|
||||
pushd modules/$module > /dev/null
|
||||
|
||||
# determine the local version (in git)
|
||||
module_version=$(jq -r .version package.json)
|
||||
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
|
||||
bump --quiet "$module_next_version" >> $log
|
||||
|
||||
popd > /dev/null
|
||||
done
|
||||
|
||||
# publish all the things!
|
||||
echo lerna exec --bail -- npm --dry-run publish
|
||||
|
Loading…
Reference in New Issue
Block a user