-
-
Notifications
You must be signed in to change notification settings - Fork 9.9k
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
Add brew release command #10370
Add brew release command #10370
Conversation
Review period will end on 2021-01-21 at 06:59:28 UTC. |
No.
I would say it's not worth pushing the tags (which cannot be undone) but instead telling the maintainer what command to run to do so.
Sounds good.
Yes, query GitHub.
Yes.
Sounds good (forever, in my opinion).
Yes.
Yes.
|
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.
Feel free to punt until PR further along but: would also be nice to reference this in the release docs when this PR is shipped.
Thanks, that's good feedback. I'm in agreement about not pushing the tags. Makes sense to not even risk it. Can you create a draft release that isn't attached to a tag? I'll have to play around with it. It's certainly ideal if that's the case.
This is saying that the token being used must have access to all |
Yup! The tag isn't created until it's published. That's often the flow I do for creating a release.
Yes, think so. |
Review period ended. |
Okay, here's where this command currently stands. Running The In order to generate the appropriate release notes, this command needs to have the latest commits on Alternatively, another option is to query the GitHub API for the latest commit on the I've also refactored some of the shared logic between the Lastly, I've updated the release documentation. |
👍🏻
I am fine with any of these options. I'd probably suggest "whichever one requires the least code to handle this edge case".
Good to know. Perhaps it's worth deprecating? Could add a commented-out |
Sounds good. I went with the one-line |
Okay, I'm going to go ahead and merge this. @MikeMcQuaid let me know how this works! (I'm assuming you'll be the one to make the next release). |
brew style
with your changes locally?brew typecheck
with your changes locally?brew tests
with your changes locally?brew man
locally and committed any changes?This PR adds a new
brew release
developer command to automate the release process. The command, by default, will simply bump the patch version number. If--major
or--minor
is passed, the command will bump the major and minor version numbers respectively (and reset other numbers to 0 as needed).This PR is still extremely rough (hence being marked as a draft). I'm going to immediately cancel CI because I know there are issues that I haven't yet fixed locally. However, I have a few general questions, so I figured I'd open this to track my progress.
I also plan on updating the Release docs in this PR in the future.
Additionally, there's some overlap between this command and
brew release-notes
that I plan on extracting to a new module.Questions
git fetch origin
(although I'm now realizing I probably wantgit fetch --tags origin
) before the command starts and then simply taking the highest version number fromgit tag --list --sort=-version:refname *.*.*
. Is there a way to determine the latest upstream tag rather than relying on local tags? I guess an alternative would be to query GitHub for the latest release and then use that as the base. An extension question would be: is it okay to assume that those who will run this command will be in a reasonable repository state?brew release
command will be designed for creating releases only at the tip of the master branch. If a non-tip-of-the-master-branch release is desired, this command should not be used. Is that acceptable? If so, I'll probably either callbrew update
within the command or simply fail if the brew repo isn't up to date (or, to be more precise, I'll check thatgit rev-parse HEAD
matchedgit rev-parse origin/HEAD
).git tag --sign
by default? If not, should we add a--sign
flag tobrew release
to control this? I havetag.gpgSign
enabled in my~/.gitconfig
so my tags would be signed either way, but I'm sure tha not all maintainers do.GitHub.open_api
takes an optionalscopes
argument. InGitHub.create_pull_request
, theGitHub.CREATE_ISSUE_FORK_OR_PR_SCOPES
constant which is set topublic_repo
is passed. What (if any) scope needs to be used for creating a release? Obviously, some write access to the repo is needed. Just not totally sure what to do here and hoping someone can guide me through it :)Quick Summary
Based on my answers to the questions above, here is what I'm picturing (at the moment) will happen when this command is run:
git fetch --tags origin
is run in the background.git rev-parse HEAD
doesn't matchgit rev-parse origin/HEAD
, failgit tag --list --sort=-version:refname *.*.*
args.major?
andargs.minor?
--force
is passed (which should change the failure into a warning that's still displayed)git tag
and maybe--sign
git push origin <tag>
to push the tag--no-browse
is passed.CC @MikeMcQuaid