Conversation
| ``` | ||
| $ git checkout dev | ||
| $ git pull | ||
| $ git checkout release |
7334266 to
e5e1adf
Compare
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.
|
@abhinav Can you take another look, I forgot to add the |
| return contents[:versionStart] + newVersion + contents[versionEnd:] | ||
| } | ||
|
|
||
| func updateChanges() (oldVersion string, _ error) { |
| } | ||
|
|
||
| func insertNewChangelog(contents string) (string, string, error) { | ||
| prevVersionHeader := strings.Index(contents, "# ") |
There was a problem hiding this comment.
To be extra sure that this is the start of a header you can make this "\n# ".
There was a problem hiding this comment.
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")
}
| func insertNewChangelog(contents string) (string, string, error) { | ||
| prevVersionHeader := strings.Index(contents, "# ") | ||
| versionLine := contents[prevVersionHeader:] | ||
| lastVersionEnd := strings.Index(versionLine, "(") |
There was a problem hiding this comment.
nit: the rest of the code uses "prev" to refer to the previous version but this uses "last"
| `)) | ||
|
|
||
| func getChanges(prevVersion string) ([]string, error) { | ||
| cmd := exec.Command("git", "log", "--oneline", "--no-decorate", prevVersion+"..HEAD") |
There was a problem hiding this comment.
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.)
There was a problem hiding this comment.
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.
|
|
||
| `)) | ||
|
|
||
| func getChanges(prevVersion string) ([]string, error) { |
There was a problem hiding this comment.
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.)
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.