-
Notifications
You must be signed in to change notification settings - Fork 806
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds tooling for version incrementing #13977
Conversation
Thank you for the great PR description! When this PR is ready for review, please apply the Scheduled Jetpack release: December 3, 2019. |
tools/build-release-branch.sh
Outdated
sed -r -i "s/\"version\": \".+\"/\"version\": \"${NPM_TARGET_VERSION}\"/" package.json | ||
|
||
# Commit changed files. | ||
git commit -m "update version" jetpack.php package.json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need any verification (e.g. git diff
-- "Does this look good? Y to commit".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can totally do that, good idea!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This script could be useful for updating the versions on master
as well, which is done once per release cycle. What do you think about creating a separate update-version.sh
or something that can be use independently from the release branch management (as well as within)?
Sure! That would definitely simplify logic as well. Would we want to move the git commit logic over as well? |
Yeah! I'd make the commit optional/reviewable as per Kraft's suggestion to verify. |
tools/version-update.sh
Outdated
fi | ||
|
||
# Replace all file contents. | ||
sed -r -i "s/Version: .+/Version: ${TARGET_VERSION}/" jetpack.php |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have access to -r
on my machine:
sed: illegal option -- r
usage: sed script [-Ealn] [-i extension] [file ...]
sed [-Ealn] [-i extension] [-e script] ... [-f script_file] ... [file ...]
I use macOS's default sed
:
❯ which sed
/usr/bin/sed
I suspect I could get this fixed by installing a more recent version via Homebrew, but the same problem could happen to others in the future. Should we require a specific version of sed
to run the script and bail early with an error inviting you to install if you don't have the right version? Or can we work around this somehow?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suspect that's because I'm using Ubuntu to develop this. Let me do some digging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't quite work just yet. I get the following errors when testing:
Would you like to update the version number in files to 333.4? [y/N]y
sed: 1: "jetpack.php": invalid command code j
sed: 1: "jetpack.php": invalid command code j
sed: 1: "package.json": extra characters at the end of p command
I got it to work be updating the
It seems like |
@jeherve - Just updated with something that I tested to work with the macOS version of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now it can edit the version numbers for me.
I am not sure if I did this wrong, but when I provide a version like 555.23
, it updates to that number directly. When I provide a version like 555.23-beta
, it also updates the version numbers directly but the branch that gets created also uses the -beta
suffix, branch-555.23-beta
. Ideally it would get removed, don't you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is working well! I only have one final request: could we also update JETPACK__VERSION
when we update version numbers via the script?
@jeherve - Okay, resolved. Apparently macOS sed does not like |
This seems to work well for me now. It is only failing because of
This should fix that: #14134 |
8cf8feb
to
dba0242
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rebased to include the fix from the other PR. This should be good to merge now!
Changes proposed in this Pull Request:
Is this a new feature or does it add/remove features to an existing part of Jetpack?
Testing instructions:
tools/build-release-branch.sh new
9-beta
.Expected that version number in branch and in files is as expected.
Proposed changelog entry for your changes: