Skip to content
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 JSON output option to 'prepare-release' command #486

Merged
merged 8 commits into from May 29, 2020

Conversation

ap0llo
Copy link
Contributor

@ap0llo ap0llo commented May 29, 2020

This PR adds a --format parameter to prepare-release that allows setting the output format to json.

I made some adjustments to the output format proposed in #481.
The output will look like this:

{
  "CurrentBranch": {
    "Name": "master",
    "Commit": "5a7487098ac1be1ceb4dbf72d862539cf0b0c27a",
    "Version": "0.3-pre"
  },
  "NewBranch": {
    "Name": "release/v0.2",
    "Commit": "b2f164675ffe891b66b601c00efc4343581fc8a5",
    "Version": "0.2"
  }
}
  • The output includes the id of the latest commit on the respective branches. This way, the exact version on the branch can easily be queried using get-version.
  • The property names use pascal-case instead of camel-case so the output is consistent with the JSON output of get-version
  • The properties devBranch and releaseBranch are namedCurrentBranch(the branch the command was started on) and NewBranch (the new branch that was created) instead.
    That way, the scenario that the command is started on the release branch can be handled as well. In that case, the NewBranch property will be null because no new branch was created.

Fixes #481

@AArnott
Copy link
Collaborator

AArnott commented May 29, 2020

The property names use camel-case instead of pascal-case so the output is consistent with the JSON output of get-version

Your sample actually shows PascalCase. So I'm confused as to which one is accurate.

@AArnott AArnott closed this May 29, 2020
@AArnott AArnott reopened this May 29, 2020
@ap0llo
Copy link
Contributor Author

ap0llo commented May 29, 2020

The property names use camel-case instead of pascal-case so the output is consistent with the JSON output of get-version

Your sample actually shows PascalCase. So I'm confused as to which one is accurate.

Sorry about that, I wrote that down in the wrong order.
I fixed the PR description

Copy link
Collaborator

@AArnott AArnott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great. Very well thought out and I'm glad you did it rather than me because you took care to handle scenarios I wouldn't have thought of.
Just a couple of nits to take care of before I merge, please.

src/NerdBank.GitVersioning/ReleaseManager.cs Outdated Show resolved Hide resolved
src/NerdBank.GitVersioning/ReleaseManager.cs Outdated Show resolved Hide resolved
@AArnott AArnott merged commit 3e4e1f8 into dotnet:master May 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make output of "prepare-release" command machine-readable
2 participants