mirror of
				https://gitea.com/gitea/tea.git
				synced 2025-10-31 01:05:26 +01:00 
			
		
		
		
	| @@ -19,6 +19,7 @@ git clone git@try.gitea.io:gitea/gitea.git | |||||||
| cd gitea | cd gitea | ||||||
| tea login add --name=try --url=https://try.gitea.io --token=xxxxxx | tea login add --name=try --url=https://try.gitea.io --token=xxxxxx | ||||||
| tea issues | tea issues | ||||||
|  | tea releases | ||||||
| ``` | ``` | ||||||
|  |  | ||||||
| ## Contributing | ## Contributing | ||||||
|   | |||||||
| @@ -8,6 +8,8 @@ import ( | |||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"log" | 	"log" | ||||||
|  |  | ||||||
|  | 	"code.gitea.io/sdk/gitea" | ||||||
|  |  | ||||||
| 	"github.com/urfave/cli" | 	"github.com/urfave/cli" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| @@ -17,6 +19,9 @@ var CmdReleases = cli.Command{ | |||||||
| 	Usage:       "Log in a Gitea server", | 	Usage:       "Log in a Gitea server", | ||||||
| 	Description: `Log in a Gitea server`, | 	Description: `Log in a Gitea server`, | ||||||
| 	Action:      runReleases, | 	Action:      runReleases, | ||||||
|  | 	Subcommands: []cli.Command{ | ||||||
|  | 		CmdReleaseCreate, | ||||||
|  | 	}, | ||||||
| 	Flags: []cli.Flag{ | 	Flags: []cli.Flag{ | ||||||
| 		cli.StringFlag{ | 		cli.StringFlag{ | ||||||
| 			Name:  "login, l", | 			Name:  "login, l", | ||||||
| @@ -51,3 +56,55 @@ func runReleases(ctx *cli.Context) error { | |||||||
|  |  | ||||||
| 	return nil | 	return nil | ||||||
| } | } | ||||||
|  |  | ||||||
|  | var CmdReleaseCreate = cli.Command{ | ||||||
|  | 	Name:        "create", | ||||||
|  | 	Usage:       "Create a release in repository", | ||||||
|  | 	Description: `Create a release in repository`, | ||||||
|  | 	Action:      runReleaseCreate, | ||||||
|  | 	Flags: []cli.Flag{ | ||||||
|  | 		cli.StringFlag{ | ||||||
|  | 			Name:  "tag", | ||||||
|  | 			Usage: "release tag name", | ||||||
|  | 		}, | ||||||
|  | 		cli.StringFlag{ | ||||||
|  | 			Name:  "target", | ||||||
|  | 			Usage: "release target refs, branch name or commit id", | ||||||
|  | 		}, | ||||||
|  | 		cli.StringFlag{ | ||||||
|  | 			Name:  "title, t", | ||||||
|  | 			Usage: "release title to create", | ||||||
|  | 		}, | ||||||
|  | 		cli.StringFlag{ | ||||||
|  | 			Name:  "note, n", | ||||||
|  | 			Usage: "release note to create", | ||||||
|  | 		}, | ||||||
|  | 		cli.BoolFlag{ | ||||||
|  | 			Name:  "draft, d", | ||||||
|  | 			Usage: "the release is a draft", | ||||||
|  | 		}, | ||||||
|  | 		cli.BoolFlag{ | ||||||
|  | 			Name:  "prerelease, p", | ||||||
|  | 			Usage: "the release is a prerelease", | ||||||
|  | 		}, | ||||||
|  | 	}, | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func runReleaseCreate(ctx *cli.Context) error { | ||||||
|  | 	login, owner, repo := initCommand(ctx) | ||||||
|  |  | ||||||
|  | 	_, err := login.Client().CreateRelease(owner, repo, gitea.CreateReleaseOption{ | ||||||
|  | 		TagName:      ctx.String("tag"), | ||||||
|  | 		Target:       ctx.String("target"), | ||||||
|  | 		Title:        ctx.String("title"), | ||||||
|  | 		Note:         ctx.String("note"), | ||||||
|  | 		IsDraft:      ctx.Bool("draft"), | ||||||
|  | 		IsPrerelease: ctx.Bool("prerelease"), | ||||||
|  | 	}) | ||||||
|  |  | ||||||
|  | 	if err != nil { | ||||||
|  | 		log.Fatal(err) | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	return nil | ||||||
|  | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Lunny Xiao
					Lunny Xiao