Release runner

This commit is contained in:
LittleSheep 2025-01-11 20:41:30 +08:00
parent 9b4979af39
commit 5c24b4f547
2 changed files with 11 additions and 0 deletions

View File

@ -19,6 +19,7 @@ type ProductRelease struct {
Type ProductReleaseType `json:"type"`
Channel string `json:"channel"`
Assets datatypes.JSONType[map[string]ReleaseAsset] `json:"assets"`
Runners datatypes.JSONType[map[string]ReleaseRunner] `json:"runner"`
Installers datatypes.JSONType[map[string]ReleaseInstaller] `json:"installers"`
ProductID uint `json:"product_id"`
@ -50,3 +51,9 @@ type ReleaseInstallerPatch struct {
Action string `json:"action" validate:"required"`
Glob string `json:"glob" validate:"required"`
}
type ReleaseRunner struct {
Workdir string `json:"workdir"`
Script string `json:"script"`
Label string `json:"label"`
}

View File

@ -58,6 +58,7 @@ func createRelease(c *fiber.Ctx) error {
Content string `json:"content" validate:"required"`
Assets map[string]models.ReleaseAsset `json:"assets" validate:"required"`
Installers map[string]models.ReleaseInstaller `json:"installers" validate:"required"`
Runners map[string]models.ReleaseRunner `json:"runners" validate:"required"`
Attachments []string `json:"attachments"`
}
@ -76,6 +77,7 @@ func createRelease(c *fiber.Ctx) error {
Channel: data.Channel,
Assets: datatypes.NewJSONType(data.Assets),
Installers: datatypes.NewJSONType(data.Installers),
Runners: datatypes.NewJSONType(data.Runners),
ProductID: product.ID,
Meta: models.ProductReleaseMeta{
Title: data.Title,
@ -110,6 +112,7 @@ func updateRelease(c *fiber.Ctx) error {
Content string `json:"content" validate:"required"`
Assets map[string]models.ReleaseAsset `json:"assets" validate:"required"`
Installers map[string]models.ReleaseInstaller `json:"installers" validate:"required"`
Runners map[string]models.ReleaseRunner `json:"runners" validate:"required"`
Attachments []string `json:"attachments"`
}
@ -132,6 +135,7 @@ func updateRelease(c *fiber.Ctx) error {
release.Channel = data.Channel
release.Assets = datatypes.NewJSONType(data.Assets)
release.Installers = datatypes.NewJSONType(data.Installers)
release.Runners = datatypes.NewJSONType(data.Runners)
release.Meta.Title = data.Title
release.Meta.Description = data.Description
release.Meta.Content = data.Content