-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bash script for doing release checklist, resolves #223
- Loading branch information
1 parent
2c2e4f9
commit 7065096
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/bin/bash | ||
|
||
# Get the last version tag | ||
readonly LAST_VERSION_TAG=$(git describe --abbrev=0 --tags) | ||
|
||
# Prompt user for new version | ||
read -p "Enter the new version number (most recent tag: ${LAST_VERSION_TAG#"v"}): " NEW_VERSION | ||
readonly NEW_VERSION | ||
|
||
# Validate input: Check if the input is a valid version number | ||
if ! [[ $NEW_VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | ||
echo "Error: Invalid version number. Please try again with proper semver formatting." | ||
exit 1 | ||
fi | ||
|
||
####################################### | ||
|
||
# Replace [unreleased] placeholders throughout src files | ||
grep -FRl --exclude='*/node_modules/*' --exclude='*/vendor/*' '[unreleased]' src assets | xargs sed -i -e "s/\[unreleased\]/$NEW_VERSION/g" | ||
|
||
# Replace header value in readme.txt for WordPress.org plugin page | ||
sed -i "s/Stable tag: .*/Stable tag: $NEW_VERSION/" readme.txt | ||
|
||
# Replace release heading in changelog.md with specified new version and current date | ||
readonly TODAY=$(date +'%Y-%m-%d') | ||
sed -i "s/### \[unreleased\]/### $NEW_VERSION - $TODAY/" changelog.md | ||
|
||
####################################### | ||
|
||
# Review and confirm changes | ||
echo | ||
echo "Release checklist changes applied." | ||
echo "Please review the changes and confirm this release:" | ||
echo | ||
echo "git status" | ||
echo "git diff" | ||
echo | ||
echo "git commit -m \"bump v$NEW_VERSION\"" | ||
echo "git tag -a \"v$NEW_VERSION\" -m \"see changelog.md\"" | ||
echo "git push --tags" | ||
echo |