This repository was archived by the owner on Aug 26, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +27
-5
lines changed
Expand file tree Collapse file tree 5 files changed +27
-5
lines changed Original file line number Diff line number Diff line change @@ -115,7 +115,12 @@ message:
115115
116116- [x] 支持release
117117 ` SEALOS_TYPE: "/comment" ` # 评论触发
118-
118+ example:
119+ ``` markdown
120+ /release v1.2.1
121+ /release v1.2.3 release-v1.2
122+ ```
123+ > 目标分支为` release-v1.2 ` ,如果没有则默认为` main ` 分支,该功能v0.0.7-rc1支持
119124- [x] 支持PR文本替换回复
120125 - ` SEALOS_TYPE: "pr_comment" ` # PR文本替换回复
121126 - ` SEALOS_filename: "README.md" ` # PR文本替换回复文件位置
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ const (
3131 gitCommit = "cd /tmp/fork-sealos-repo && git commit -am '%s' -s"
3232 gitRelease = "cd /tmp/fork-sealos-repo && git describe --abbrev=0 --tags"
3333 gitTag = "cd /tmp/fork-sealos-repo && git fetch --tags && git tag -l"
34+ gitCheck = "cd /tmp/fork-sealos-repo && git checkout fork/%s"
3435 gitNewTag = "cd /tmp/fork-sealos-repo && git tag %s"
3536 gitAddRemote = "cd /tmp/fork-sealos-repo && git remote add fork https://%s:%s@github.com/%s.git"
3637 gitPushRemote = "cd /tmp/fork-sealos-repo && git push -f fork %s"
Original file line number Diff line number Diff line change @@ -22,15 +22,22 @@ import (
2222 "github.com/pkg/errors"
2323)
2424
25- func Tag (tag string ) error {
25+ func Tag (tag , branch string ) error {
2626 if err := setPreGithub (); err != nil {
2727 return err
2828 }
29+ var firstShell any
30+ if branch == "" {
31+ firstShell = utils .SkipShell ("" )
32+ } else {
33+ firstShell = fmt .Sprintf (gitCheck , branch )
34+ }
2935 if ok , err := checkRemoteTagExists (tag ); err != nil {
3036 return err
3137 } else {
3238 if ! ok {
3339 shells := []any {
40+ firstShell ,
3441 fmt .Sprintf (gitNewTag , tag ),
3542 fmt .Sprintf (gitPushRemote , tag ),
3643 }
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ import (
2929type RetryShell string
3030type RetrySecretShell string
3131type SecretShell string
32+ type SkipShell string
3233
3334func ExecShellForAny (secrets ... string ) func (shells []any ) error {
3435 return func (shells []any ) error {
@@ -55,11 +56,15 @@ func ExecShellForAny(secrets ...string) func(shells []any) error {
5556 return err
5657 }
5758 }
59+ if _ , ok := sh .(SkipShell ); ok {
60+ continue
61+ }
5862 if s , ok := sh .(string ); ok {
5963 if err := RunCommand ("bash" , "-c" , s ); err != nil {
6064 return err
6165 }
6266 }
67+
6368 }
6469 return nil
6570 }
Original file line number Diff line number Diff line change @@ -34,8 +34,12 @@ func (c *release) Run() error {
3434 return c .sender .sendMsgToIssue ("permission_error" )
3535 }
3636 data := strings .Split (c .Body , " " )
37- if len (data ) == 2 && utils .ValidateVersion (data [1 ]) {
38- err := gh .Tag (data [1 ])
37+ if (2 == len (data ) || 3 == len (data )) && utils .ValidateVersion (data [1 ]) {
38+ var newBranch string
39+ if len (data ) == 3 {
40+ newBranch = data [2 ]
41+ }
42+ err := gh .Tag (data [1 ], newBranch )
3943 if err != nil {
4044 c .sender .Error = err .Error ()
4145 return c .sender .sendMsgToIssue ("release_error" )
@@ -53,7 +57,7 @@ func (c *release) Run() error {
5357 }
5458 return nil
5559 } else {
56- logger .Error ("command format is error: %s ex. /{prefix}_release {tag}" , c .Body )
60+ logger .Error ("command format is error: %s ex. /{prefix}_release {tag} {branch} " , c .Body )
5761 return c .sender .sendMsgToIssue ("format_error" )
5862 }
5963}
You can’t perform that action at this time.
0 commit comments