feat(changelog): add first draft for changelog generation

This commit is contained in:
Nightapes
2019-05-25 18:10:24 +02:00
parent 9f7d3e3b58
commit fc7e6366c2
7 changed files with 188 additions and 34 deletions

View File

@@ -2,6 +2,7 @@
package main
import (
"fmt"
"os"
"github.com/Nightapes/go-semantic-release/pkg/config"
@@ -24,6 +25,11 @@ var (
setRepository = setCommand.Flag("repository", "Path to repository").String()
setConfigPath = setCommand.Flag("config", "Path to config file").Default(".release.yml").String()
setVersion = setCommand.Arg("version", "semver version").Required().String()
getChangelog = app.Command("changelog", "Print changelog.")
getChangelogRepository = getChangelog.Flag("repository", "Path to repository").String()
getChangelogConfigPath = getChangelog.Flag("config", "Path to config file").Default(".release.yml").String()
getChangelogFile = getChangelog.Flag("file", "save changelog to file").Default("CHANGELOG.md").String()
)
func main() {
@@ -32,10 +38,11 @@ func main() {
case nextCommand.FullCommand():
setLoglevel(*loglevel)
s := semanticrelease.New(readConfig(nextConfigPath))
err := s.GetNextVersion(*nextRepository, *nextForce)
version, err := s.GetNextVersion(*nextRepository, *nextForce)
if err != nil {
log.Fatal(err)
}
fmt.Println(version)
case setCommand.FullCommand():
setLoglevel(*loglevel)
@@ -45,6 +52,13 @@ func main() {
if err != nil {
log.Fatal(err)
}
case getChangelog.FullCommand():
setLoglevel(*loglevel)
s := semanticrelease.New(readConfig(getChangelogConfigPath))
err := s.GetChangelog(*getChangelogRepository, *getChangelogFile)
if err != nil {
log.Fatal(err)
}
}
}