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.
|
MikeMcQuaid
left a comment
There was a problem hiding this comment.
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 stylewith your changes locally?brew typecheckwith your changes locally?brew testswith your changes locally?brew manlocally and committed any changes?This PR adds a new
brew releasedeveloper command to automate the release process. The command, by default, will simply bump the patch version number. If--majoror--minoris 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-notesthat 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 releasecommand 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 updatewithin 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 HEADmatchedgit rev-parse origin/HEAD).git tag --signby default? If not, should we add a--signflag tobrew releaseto control this? I havetag.gpgSignenabled in my~/.gitconfigso my tags would be signed either way, but I'm sure tha not all maintainers do.GitHub.open_apitakes an optionalscopesargument. InGitHub.create_pull_request, theGitHub.CREATE_ISSUE_FORK_OR_PR_SCOPESconstant which is set topublic_repois 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 originis run in the background.git rev-parse HEADdoesn't matchgit rev-parse origin/HEAD, failgit tag --list --sort=-version:refname *.*.*args.major?andargs.minor?--forceis passed (which should change the failure into a warning that's still displayed)git tagand maybe--signgit push origin <tag>to push the tag--no-browseis passed.CC @MikeMcQuaid