Skip to content

Commit

Permalink
Merge pull request #460 from cloudflare/script-for-bumping-versions
Browse files Browse the repository at this point in the history
add scripts/bump-plugin-version.sh
  • Loading branch information
jacobbednarz authored Mar 21, 2022
2 parents 3465701 + b6b9f77 commit 068a29c
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 2 deletions.
8 changes: 6 additions & 2 deletions docs/release-new-version.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@ projects, update them and commit the changes.
### Update readme.txt and plugin version references

WordPress uses the readme.txt heavily for metadata about the plugin. You will
need to bump the version number and update `== Changelog ==` section according
to what code changes have been made since the last release.
need to update `== Changelog ==` section according to what code changes have
been made since the last release.

To bump all the places where the plugin version is defined, run
`scripts/bump-plugin-version.sh x.x.x` (replacing x.x.x) with your proposed
version number.

## Prepare to release

Expand Down
35 changes: 35 additions & 0 deletions scripts/bump-plugin-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env bash

if [ -z "$1" ]; then
echo "VERSION not provided."
exit 1
fi

VERSION=$1

echo "Preparing release: $VERSION"

echo "==> Updating config.json..."
# config.json
NEW_CONFIG_JSON=$(cat config.json | jq ".version |= \"$VERSION\""); echo $NEW_CONFIG_JSON | jq . > config.json
echo "==> Complete ✅"

echo "==> Updating composer.json..."
# composer.json
NEW_COMPOSER_JSON=$(cat composer.json | jq ".version |= \"$VERSION\""); echo $NEW_COMPOSER_JSON | jq . > composer.json
echo "==> Complete ✅"

echo "==> Updating readme.txt..."
# readme.txt
sed -i '' "s/Stable tag:.*/Stable tag: $VERSION/g" readme.txt
echo "==> Complete ✅"

echo "==> Updating cloudflare.php..."
# cloudflare.php
sed -i '' "s/Version:.*/Version: $VERSION/g" cloudflare.php
echo "==> Complete ✅"
echo
echo "Release preparation complete! Don't forget to:"
echo "- Add a CHANGELOG entry to readme.txt"
echo "- \`composer update --no-dev\` to update the content-hash attribute"
echo "- Commit all the changes and push!"

0 comments on commit 068a29c

Please sign in to comment.