2019-07-25 03:47:41 +00:00
|
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
# Enable nicer messaging for build status.
|
|
|
|
|
BLUE_BOLD='\033[1;34m';
|
|
|
|
|
GREEN_BOLD='\033[1;32m';
|
|
|
|
|
RED_BOLD='\033[1;31m';
|
|
|
|
|
YELLOW_BOLD='\033[1;33m';
|
|
|
|
|
COLOR_RESET='\033[0m';
|
|
|
|
|
|
|
|
|
|
error () {
|
|
|
|
|
echo -e "\n🤯 ${RED_BOLD}$1${COLOR_RESET}\n"
|
|
|
|
|
}
|
|
|
|
|
status () {
|
|
|
|
|
echo -e "\n👩💻 ${BLUE_BOLD}$1${COLOR_RESET}\n"
|
|
|
|
|
}
|
|
|
|
|
success () {
|
|
|
|
|
echo -e "\n✅ ${GREEN_BOLD}$1${COLOR_RESET}\n"
|
|
|
|
|
}
|
|
|
|
|
warning () {
|
|
|
|
|
echo -e "\n${YELLOW_BOLD}$1${COLOR_RESET}\n"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Make sure there are no changes in the working tree.
|
|
|
|
|
changed=
|
|
|
|
|
if ! git diff --exit-code > /dev/null; then
|
|
|
|
|
changed="file(s) modified"
|
|
|
|
|
elif ! git diff --cached --exit-code > /dev/null; then
|
|
|
|
|
changed="file(s) staged"
|
|
|
|
|
fi
|
|
|
|
|
if [ ! -z "$changed" ]; then
|
|
|
|
|
git status
|
|
|
|
|
error "ERROR: Cannot start pre-release with dirty working tree. ☝️ Commit your changes and try again."
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
status "Lets release WooCommerce Admin 🎉"
|
|
|
|
|
|
2019-12-20 12:24:26 +00:00
|
|
|
|
status "What branch/commit would you like to base this release on?"
|
2019-07-25 03:47:41 +00:00
|
|
|
|
|
2019-12-20 12:24:26 +00:00
|
|
|
|
echo -n "Branch/commit: "
|
2019-07-25 03:47:41 +00:00
|
|
|
|
|
2019-12-20 12:24:26 +00:00
|
|
|
|
read refspec
|
|
|
|
|
|
|
|
|
|
git checkout $refspec || { error "ERROR: Unable to checkout ${refspec}." ; exit 1; }
|
|
|
|
|
|
|
|
|
|
success "Checked out ${refspec}"
|
|
|
|
|
|
|
|
|
|
git pull origin ${refspec}
|
2019-07-25 03:47:41 +00:00
|
|
|
|
|
|
|
|
|
success "Pulled latest commits"
|
|
|
|
|
|
|
|
|
|
status "What version would you like to release?"
|
|
|
|
|
|
|
|
|
|
echo -n "Version: "
|
|
|
|
|
|
|
|
|
|
read release
|
|
|
|
|
|
|
|
|
|
branch="release/${release}"
|
|
|
|
|
|
|
|
|
|
exists=`git show-ref refs/heads/${branch}`
|
|
|
|
|
|
|
|
|
|
if [ -n "$exists" ]; then
|
|
|
|
|
error "ERROR: release branch already exists."
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
status "creating a release branch"
|
|
|
|
|
|
2019-07-26 01:59:10 +00:00
|
|
|
|
git checkout -b $branch || { error "ERROR: Unable to create release branch." ; exit 1; }
|
2019-07-25 03:47:41 +00:00
|
|
|
|
|
|
|
|
|
success "Release branch created: ${branch}"
|
|
|
|
|
|
|
|
|
|
status "Bumping version to ${release}"
|
|
|
|
|
|
2022-03-04 04:01:16 +00:00
|
|
|
|
pnpm --no-git-tag-version version $release || { error "ERROR: Invalid version number." ; exit 1; }
|
2019-07-25 03:47:41 +00:00
|
|
|
|
|
|
|
|
|
success "Version bumped successfully"
|
|
|
|
|
|
2020-08-04 01:13:48 +00:00
|
|
|
|
status "Run scripts to propagate version numbers and update dependencies."
|
2019-07-25 03:47:41 +00:00
|
|
|
|
|
2022-03-04 04:01:16 +00:00
|
|
|
|
pnpm run bump-version
|
2019-07-25 03:47:41 +00:00
|
|
|
|
|
|
|
|
|
status "Here are the changes so far. Make sure the following changes are reflected."
|
|
|
|
|
|
|
|
|
|
echo "- docs/: folder will have changes to documentation, if any."
|
|
|
|
|
echo "- package.json: new version number."
|
2020-11-15 22:59:11 +00:00
|
|
|
|
echo "- woocommerce-admin.php: new version number."
|
|
|
|
|
echo "- composer.json: new version number."
|
|
|
|
|
echo "- readme.txt: new version number."
|
2022-03-03 12:40:41 +00:00
|
|
|
|
echo "- src-internal/Admin/FeaturePlugin.php: new version number."
|
2020-11-15 22:59:11 +00:00
|
|
|
|
echo "- src/Composer/Package.php: new version number."
|
|
|
|
|
echo "- package-lock.json: dependencies updated."
|
2019-07-25 03:47:41 +00:00
|
|
|
|
echo -e "\n"
|
|
|
|
|
echo -e "\n"
|
|
|
|
|
|
|
|
|
|
git status
|