diff options
Diffstat (limited to 'releaser/releaser.go')
-rw-r--r-- | releaser/releaser.go | 47 |
1 files changed, 35 insertions, 12 deletions
diff --git a/releaser/releaser.go b/releaser/releaser.go index 17529acf2..230a498e6 100644 --- a/releaser/releaser.go +++ b/releaser/releaser.go @@ -128,7 +128,7 @@ func (r *ReleaseHandler) Run() error { } if r.shouldPrepareReleasenotes() { - releaseNotesFile, err := writeReleaseNotesToDocsTemp(version, gitCommits) + releaseNotesFile, err := writeReleaseNotesToTemp(version, gitCommits) if err != nil { return err } @@ -142,13 +142,24 @@ func (r *ReleaseHandler) Run() error { } if r.shouldPrepareVersions() { - if err := bumpVersions(newVersion); err != nil { + // Make sure the docs submodule is up to date. + if _, err := git("submodule", "update", "--remote", "--merge"); err != nil { + return err + } + // TODO(bep) the above may not have changed anything. + if _, err := git("commit", "-a", "-m", fmt.Sprintf("%s Update /docs [ci skip]", commitPrefix)); err != nil { return err } - if _, err := git("commit", "-a", "-m", fmt.Sprintf("%s Bump versions for release of %s\n\n[ci skip]", commitPrefix, newVersion)); err != nil { + if err := bumpVersions(newVersion); err != nil { return err } + + for _, repo := range []string{"docs", "."} { + if _, err := git("-C", repo, "commit", "-a", "-m", fmt.Sprintf("%s Bump versions for release of %s\n\n[ci skip]", commitPrefix, newVersion)); err != nil { + return err + } + } } if !r.shouldRelease() { @@ -164,19 +175,29 @@ func (r *ReleaseHandler) Run() error { return err } - if _, err := git("add", docFile); err != nil { + if _, err := git("-C", "docs", "add", docFile); err != nil { return err } - if _, err := git("commit", "-m", fmt.Sprintf("%s Add relase notes to /docs for release of %s\n\n[ci skip]", commitPrefix, newVersion)); err != nil { + if _, err := git("-C", "docs", "commit", "-m", fmt.Sprintf("%s Add relase notes to /docs for release of %s\n\n[ci skip]", commitPrefix, newVersion)); err != nil { return err } - if _, err := git("tag", "-a", tag, "-m", fmt.Sprintf("%s %s [ci deploy]", commitPrefix, newVersion)); err != nil { - return err - } + for i, repo := range []string{"docs", "."} { + if i == 1 { + if _, err := git("add", "docs"); err != nil { + return err + } + if _, err := git("commit", "-m", fmt.Sprintf("%s Update /docs to %s [ci skip]", commitPrefix, newVersion)); err != nil { + return err + } + } + if _, err := git("-C", repo, "tag", "-a", tag, "-m", fmt.Sprintf("%s %s [ci deploy]", commitPrefix, newVersion)); err != nil { + return err + } - if _, err := git("push", "origin", tag); err != nil { - return err + if _, err := git("-C", repo, "push", "origin", tag); err != nil { + return err + } } if err := r.release(releaseNotesFile); err != nil { @@ -192,8 +213,10 @@ func (r *ReleaseHandler) Run() error { return err } - if _, err := git("commit", "-a", "-m", fmt.Sprintf("%s Prepare repository for %s\n\n[ci skip]", commitPrefix, finalVersion)); err != nil { - return err + for _, repo := range []string{"docs", "."} { + if _, err := git("-C", repo, "commit", "-a", "-m", fmt.Sprintf("%s Prepare repository for %s\n\n[ci skip]", commitPrefix, finalVersion)); err != nil { + return err + } } return nil |