Skip to content

Document and automate parts of the release process#666

Merged
prashantv merged 4 commits intodevfrom
release
Nov 22, 2017
Merged

Document and automate parts of the release process#666
prashantv merged 4 commits intodevfrom
release

Conversation

@prashantv
Copy link
Copy Markdown
Contributor

We currently have an undocumented release process. Document the
different steps and try to automate parts.

The version bumping script is just one part of the process, in future
we'll want to automate the branch/tags as well as updating the release
on GitHub.

Comment thread RELEASE.md Outdated
```
$ git checkout dev
$ git pull
$ git checkout release
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

indentation inconsistent

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

👍

@prashantv prashantv force-pushed the dev branch 2 times, most recently from 7334266 to e5e1adf Compare November 7, 2017 18:12
We currently have an undocumented release process. Document the
different steps and try to automate parts.

The version bumping script is just one part of the process, in future
we'll want to automate the branch/tags as well as updating the release
on GitHub.
@prashantv
Copy link
Copy Markdown
Contributor Author

@abhinav Can you take another look, I forgot to add the vbumper script which updates the CHANGELOG.md and version.go files earlier. Thanks!

@prashantv prashantv merged commit 7d2bb44 into dev Nov 22, 2017
@prashantv prashantv deleted the release branch November 22, 2017 01:40
Comment thread scripts/vbumper/main.go
return contents[:versionStart] + newVersion + contents[versionEnd:]
}

func updateChanges() (oldVersion string, _ error) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: updateChangelog

Comment thread scripts/vbumper/main.go
}

func insertNewChangelog(contents string) (string, string, error) {
prevVersionHeader := strings.Index(contents, "# ")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

To be extra sure that this is the start of a header you can make this "\n# ".

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Also, depending on how safe you want this to be, consider adding < 0 checks for all Index calls.

prevVersionHeader := ...
if prevVersionHeader < 0 {
  return "", "", errors.New("could not find a section for the previous version")
}

Comment thread scripts/vbumper/main.go
func insertNewChangelog(contents string) (string, string, error) {
prevVersionHeader := strings.Index(contents, "# ")
versionLine := contents[prevVersionHeader:]
lastVersionEnd := strings.Index(versionLine, "(")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: the rest of the code uses "prev" to refer to the previous version but this uses "last"

Comment thread scripts/vbumper/main.go
`))

func getChanges(prevVersion string) ([]string, error) {
cmd := exec.Command("git", "log", "--oneline", "--no-decorate", prevVersion+"..HEAD")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Simpler to use git log --format=%s here instead. (%s is just the subject of the commit—what you get from --oneline but without the commit IDs, decoration, etc.)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Also, you probably want --no-merges here as well otherwise your changelog will include "Merge $branch into master" or similar if you ever do a merge commit.

Comment thread scripts/vbumper/main.go

`))

func getChanges(prevVersion string) ([]string, error) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Making commit subjects part of the changelog means you have to be extra
prudent about good commit subjects.

In the future, consider adding a filter that lets commits opt out of being
added to the changelog if they're not user-affecting. It can be as simple as,

git log --format=%s --grep="^SKIP CHANGELOG" --invert-grep [range]

That will get you subjects for all commits that don't have a line "SKIP
CHANGELOG" in their commit bodies. (Opt-out message TBD.)

prashantv added a commit that referenced this pull request Nov 27, 2017
Address comments from
#666
prashantv added a commit that referenced this pull request Nov 27, 2017
Address comments from
#666
prashantv added a commit that referenced this pull request Nov 27, 2017
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.

2 participants