@@ -19,14 +19,11 @@ package pre_release
19
19
import (
20
20
"fmt"
21
21
"io/fs"
22
- "os"
23
- "os/exec"
24
- "path"
25
22
"path/filepath"
26
23
"strings"
27
- "time"
28
24
29
25
"vitess.io/vitess-releaser/go/releaser"
26
+ "vitess.io/vitess-releaser/go/releaser/code_freeze"
30
27
"vitess.io/vitess-releaser/go/releaser/git"
31
28
"vitess.io/vitess-releaser/go/releaser/github"
32
29
"vitess.io/vitess-releaser/go/releaser/logging"
@@ -36,31 +33,6 @@ import (
36
33
const (
37
34
examplesOperator = "./examples/operator"
38
35
examplesCompose = "./examples/compose/"
39
-
40
- versionGoFile = "./go/vt/servenv/version.go"
41
- versionGo = `/*
42
- Copyright %d The Vitess Authors.
43
-
44
- Licensed under the Apache License, Version 2.0 (the "License");
45
- you may not use this file except in compliance with the License.
46
- You may obtain a copy of the License at
47
-
48
- http://www.apache.org/licenses/LICENSE-2.0
49
-
50
- Unless required by applicable law or agreed to in writing, software
51
- distributed under the License is distributed on an "AS IS" BASIS,
52
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
53
- See the License for the specific language governing permissions and
54
- limitations under the License.
55
- */
56
-
57
- package servenv
58
-
59
- // DO NOT EDIT
60
- // THIS FILE IS AUTO-GENERATED DURING NEW RELEASES BY THE VITESS-RELEASER
61
-
62
- const versionName = "%s"
63
- `
64
36
)
65
37
66
38
func CreateReleasePR (state * releaser.State ) (* logging.ProgressLogging , func () string ) {
@@ -112,7 +84,7 @@ func CreateReleasePR(state *releaser.State) (*logging.ProgressLogging, func() st
112
84
// deactivate code freeze
113
85
if unfreezeBranch {
114
86
pl .NewStepf ("Deactivate code freeze on %s" , state .VitessRelease .ReleaseBranch )
115
- deactivateCodeFreeze ()
87
+ code_freeze . DeactivateCodeFreeze ()
116
88
117
89
pl .NewStepf ("Commit unfreezing the branch %s" , state .VitessRelease .ReleaseBranch )
118
90
if ! git .CommitAll (fmt .Sprintf ("Unfreeze branch %s" , state .VitessRelease .ReleaseBranch )) {
@@ -135,10 +107,10 @@ func CreateReleasePR(state *releaser.State) (*logging.ProgressLogging, func() st
135
107
updateExamples (lowerRelease , strings .ToLower (releaser .AddRCToReleaseTitle (state .VtOpRelease .Release , state .Issue .RC )))
136
108
137
109
pl .NewStepf ("Update version.go" )
138
- UpdateVersionGoFile (lowerRelease )
110
+ releaser . UpdateVersionGoFile (lowerRelease )
139
111
140
112
pl .NewStepf ("Update the Java directory" )
141
- UpdateJavaDir (lowerRelease )
113
+ releaser . UpdateJavaDir (lowerRelease )
142
114
143
115
pl .NewStepf ("Commit the update to the codebase for the v%s release" , state .VitessRelease .Release )
144
116
if ! git .CommitAll (fmt .Sprintf ("Update codebase for the v%s release" , state .VitessRelease .Release )) {
@@ -225,25 +197,3 @@ func updateExamples(newVersion, vtopNewVersion string) {
225
197
args = append ([]string {"-f" }, filesBackups ... )
226
198
utils .Exec ("rm" , args ... )
227
199
}
228
-
229
- func UpdateVersionGoFile (newVersion string ) {
230
- err := os .WriteFile (versionGoFile , []byte (fmt .Sprintf (versionGo , time .Now ().Year (), newVersion )), os .ModePerm )
231
- if err != nil {
232
- utils .LogPanic (err , "failed to write to file %s" , versionGoFile )
233
- }
234
- }
235
-
236
- func UpdateJavaDir (newVersion string ) {
237
- // cd $ROOT/java || exit 1
238
- // mvn versions:set -DnewVersion=$1
239
- cmd := exec .Command ("mvn" , "versions:set" , fmt .Sprintf ("-DnewVersion=%s" , newVersion ))
240
- pwd , err := os .Getwd ()
241
- if err != nil {
242
- utils .LogPanic (err , "failed to get current working directory" )
243
- }
244
- cmd .Dir = path .Join (pwd , "/java" )
245
- out , err := cmd .CombinedOutput ()
246
- if err != nil {
247
- utils .LogPanic (err , "failed to execute: %s, got: %s" , cmd .String (), string (out ))
248
- }
249
- }
0 commit comments