mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-29 20:02:09 -05:00
parent
5f831a6223
commit
70d8ddcb60
1 changed files with 18 additions and 53 deletions
|
@ -51,7 +51,7 @@ func (r ReleaseHandler) shouldRelease() bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r ReleaseHandler) shouldContinue() bool {
|
func (r ReleaseHandler) shouldContinue() bool {
|
||||||
return r.step == 3
|
return r.step >= 3
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r ReleaseHandler) shouldPrepareReleasenotes() bool {
|
func (r ReleaseHandler) shouldPrepareReleasenotes() bool {
|
||||||
|
@ -59,7 +59,7 @@ func (r ReleaseHandler) shouldPrepareReleasenotes() bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r ReleaseHandler) shouldPrepareVersions() bool {
|
func (r ReleaseHandler) shouldPrepareVersions() bool {
|
||||||
return r.step < 1 || r.step == 2
|
return r.step < 1 || r.step == 2 || r.step > 3
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r ReleaseHandler) calculateVersions() (helpers.HugoVersion, helpers.HugoVersion) {
|
func (r ReleaseHandler) calculateVersions() (helpers.HugoVersion, helpers.HugoVersion) {
|
||||||
|
@ -150,37 +150,23 @@ func (r *ReleaseHandler) Run() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if r.shouldPrepareVersions() {
|
if r.shouldPrepareVersions() {
|
||||||
if newVersion.PatchLevel == 0 {
|
|
||||||
// Make sure the docs submodule is up to date.
|
|
||||||
// TODO(bep) improve this. Maybe it was not such a good idea to do
|
|
||||||
// this in the sobmodule directly.
|
|
||||||
if _, err := r.git("submodule", "update", "--init"); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
//git submodule update
|
|
||||||
if _, err := r.git("submodule", "update", "--remote", "--merge"); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO(bep) the above may not have changed anything.
|
// For docs, for now we assume that:
|
||||||
if _, err := r.git("commit", "-a", "-m", fmt.Sprintf("%s Update /docs [ci skip]", commitPrefix)); err != nil {
|
// The /docs subtree is up to date and ready to go.
|
||||||
return err
|
// The hugoDocs/dev and hugoDocs/master must be merged manually after release.
|
||||||
}
|
// TODO(bep) improve this when we see how it works.
|
||||||
}
|
|
||||||
|
|
||||||
if err := r.bumpVersions(newVersion); err != nil {
|
if err := r.bumpVersions(newVersion); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, repo := range []string{"docs", "."} {
|
if _, err := r.git("commit", "-a", "-m", fmt.Sprintf("%s Bump versions for release of %s\n\n[ci skip]", commitPrefix, newVersion)); err != nil {
|
||||||
if _, err := r.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
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !r.shouldRelease() {
|
if !r.shouldRelease() {
|
||||||
fmt.Println("Skip release ... Use --state=3 to continue.")
|
fmt.Printf("Skip release ... Use --state=%d for next or --state=4 to finish\n", r.step+1)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,39 +178,20 @@ func (r *ReleaseHandler) Run() error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, err := r.git("-C", "docs", "add", docFile); err != nil {
|
if _, err := r.git("add", docFile); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if _, err := r.git("-C", "docs", "commit", "-m", fmt.Sprintf("%s Add release notes to /docs for release of %s\n\n[ci skip]", commitPrefix, newVersion)); err != nil {
|
if _, err := r.git("commit", "-m", fmt.Sprintf("%s Add release notes to /docs for release of %s\n\n[ci skip]", commitPrefix, newVersion)); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
for i, repo := range []string{"docs", "."} {
|
if _, err := r.git("tag", "-a", tag, "-m", fmt.Sprintf("%s %s [ci deploy]", commitPrefix, newVersion)); err != nil {
|
||||||
if i == 1 {
|
return err
|
||||||
if _, err := r.git("add", "docs"); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if _, err := r.git("commit", "-m", fmt.Sprintf("%s Update /docs to %s [ci skip]", commitPrefix, newVersion)); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if _, err := r.git("-C", repo, "tag", "-a", tag, "-m", fmt.Sprintf("%s %s [ci deploy]", commitPrefix, newVersion)); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
repoURL := "git@github.com:gohugoio/hugo.git"
|
|
||||||
if i == 0 {
|
|
||||||
repoURL = "git@github.com:gohugoio/hugoDocs.git"
|
|
||||||
}
|
|
||||||
if _, err := r.git("-C", repo, "push", repoURL, "origin/master", tag); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// We make changes to the submodule, which is in detached state. Reconsider this
|
if _, err := r.git("push", tag); err != nil {
|
||||||
// to get changes pushed to both.
|
return err
|
||||||
// TODO(bep) git fetch git@github.com:gohugoio/hugoDocs.git -- master
|
}
|
||||||
// git branch -f master 8c9359b
|
|
||||||
|
|
||||||
if err := r.release(releaseNotesFile); err != nil {
|
if err := r.release(releaseNotesFile); err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -241,10 +208,8 @@ func (r *ReleaseHandler) Run() error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, repo := range []string{"docs", "."} {
|
if _, err := r.git("commit", "-a", "-m", fmt.Sprintf("%s Prepare repository for %s\n\n[ci skip]", commitPrefix, finalVersion)); err != nil {
|
||||||
if _, err := r.git("-C", repo, "commit", "-a", "-m", fmt.Sprintf("%s Prepare repository for %s\n\n[ci skip]", commitPrefix, finalVersion)); err != nil {
|
return err
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in a new issue