mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-02-05 13:15:26 +02:00
feat: add support for scripts in Scoop manifests (#1931)
* feat: add support for scripts in Scoop manifests * fix: remove hidden newline from scoop golden file
This commit is contained in:
parent
264dedc12a
commit
c10e597953
@ -142,12 +142,14 @@ func doRun(ctx *context.Context, cl client.Client) error {
|
||||
// Manifest represents a scoop.sh App Manifest.
|
||||
// more info: https://github.com/lukesampson/scoop/wiki/App-Manifests
|
||||
type Manifest struct {
|
||||
Version string `json:"version"` // The version of the app that this manifest installs.
|
||||
Architecture map[string]Resource `json:"architecture"` // `architecture`: If the app has 32- and 64-bit versions, architecture can be used to wrap the differences.
|
||||
Homepage string `json:"homepage,omitempty"` // `homepage`: The home page for the program.
|
||||
License string `json:"license,omitempty"` // `license`: The software license for the program. For well-known licenses, this will be a string like "MIT" or "GPL2". For custom licenses, this should be the URL of the license.
|
||||
Description string `json:"description,omitempty"` // Description of the app
|
||||
Persist []string `json:"persist,omitempty"` // Persist data between updates
|
||||
Version string `json:"version"` // The version of the app that this manifest installs.
|
||||
Architecture map[string]Resource `json:"architecture"` // `architecture`: If the app has 32- and 64-bit versions, architecture can be used to wrap the differences.
|
||||
Homepage string `json:"homepage,omitempty"` // `homepage`: The home page for the program.
|
||||
License string `json:"license,omitempty"` // `license`: The software license for the program. For well-known licenses, this will be a string like "MIT" or "GPL2". For custom licenses, this should be the URL of the license.
|
||||
Description string `json:"description,omitempty"` // Description of the app
|
||||
Persist []string `json:"persist,omitempty"` // Persist data between updates
|
||||
PreInstall []string `json:"pre_install,omitempty"` // An array of strings, of the commands to be executed before an application is installed.
|
||||
PostInstall []string `json:"post_install,omitempty"` // An array of strings, of the commands to be executed after an application is installed.
|
||||
}
|
||||
|
||||
// Resource represents a combination of a url and a binary name for an architecture.
|
||||
@ -175,6 +177,8 @@ func dataFor(ctx *context.Context, cl client.Client, artifacts []*artifact.Artif
|
||||
License: ctx.Config.Scoop.License,
|
||||
Description: ctx.Config.Scoop.Description,
|
||||
Persist: ctx.Config.Scoop.Persist,
|
||||
PreInstall: ctx.Config.Scoop.PreInstall,
|
||||
PostInstall: ctx.Config.Scoop.PostInstall,
|
||||
}
|
||||
|
||||
if ctx.Config.Scoop.URLTemplate == "" {
|
||||
|
@ -790,6 +790,45 @@ func Test_buildManifest(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"testdata/test_buildmanifest_pre_post_install.json.golden",
|
||||
&context.Context{
|
||||
Context: ctx.Background(),
|
||||
TokenType: context.TokenTypeGitHub,
|
||||
Git: context.GitInfo{
|
||||
CurrentTag: "v1.0.1",
|
||||
},
|
||||
Version: "1.0.1",
|
||||
Artifacts: artifact.New(),
|
||||
Config: config.Project{
|
||||
GitHubURLs: config.GitHubURLs{
|
||||
Download: "https://github.com",
|
||||
},
|
||||
Dist: ".",
|
||||
ProjectName: "run-pipe",
|
||||
Archives: []config.Archive{
|
||||
{Format: "tar.gz"},
|
||||
},
|
||||
Release: config.Release{
|
||||
GitHub: config.Repo{
|
||||
Owner: "test",
|
||||
Name: "test",
|
||||
},
|
||||
},
|
||||
Scoop: config.Scoop{
|
||||
Bucket: config.RepoRef{
|
||||
Owner: "test",
|
||||
Name: "test",
|
||||
},
|
||||
Description: "A run pipe test formula",
|
||||
Homepage: "https://github.com/goreleaser",
|
||||
Persist: []string{"data", "config", "test.ini"},
|
||||
PreInstall: []string{"Write-Host 'Running preinstall command'"},
|
||||
PostInstall: []string{"Write-Host 'Running postinstall command'"},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"testdata/test_buildmanifest_url_template.json.golden",
|
||||
&context.Context{
|
||||
|
34
internal/pipe/scoop/testdata/test_buildmanifest_pre_post_install.json.golden
vendored
Normal file
34
internal/pipe/scoop/testdata/test_buildmanifest_pre_post_install.json.golden
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
{
|
||||
"version": "1.0.1",
|
||||
"architecture": {
|
||||
"32bit": {
|
||||
"url": "https://github.com/test/test/releases/download/v1.0.1/foo_1.0.1_windows_386.tar.gz",
|
||||
"bin": [
|
||||
"foo.exe",
|
||||
"bar.exe"
|
||||
],
|
||||
"hash": "5e2bf57d3f40c4b6df69daf1936cb766f832374b4fc0259a7cbff06e2f70f269"
|
||||
},
|
||||
"64bit": {
|
||||
"url": "https://github.com/test/test/releases/download/v1.0.1/foo_1.0.1_windows_amd64.tar.gz",
|
||||
"bin": [
|
||||
"foo.exe",
|
||||
"bar.exe"
|
||||
],
|
||||
"hash": "5e2bf57d3f40c4b6df69daf1936cb766f832374b4fc0259a7cbff06e2f70f269"
|
||||
}
|
||||
},
|
||||
"homepage": "https://github.com/goreleaser",
|
||||
"description": "A run pipe test formula",
|
||||
"persist": [
|
||||
"data",
|
||||
"config",
|
||||
"test.ini"
|
||||
],
|
||||
"pre_install": [
|
||||
"Write-Host 'Running preinstall command'"
|
||||
],
|
||||
"post_install": [
|
||||
"Write-Host 'Running postinstall command'"
|
||||
]
|
||||
}
|
@ -128,6 +128,8 @@ type Scoop struct {
|
||||
URLTemplate string `yaml:"url_template,omitempty"`
|
||||
Persist []string `yaml:"persist,omitempty"`
|
||||
SkipUpload string `yaml:"skip_upload,omitempty"`
|
||||
PreInstall []string `yaml:"pre_install,omitempty"`
|
||||
PostInstall []string `yaml:"post_install,omitempty"`
|
||||
}
|
||||
|
||||
// CommitAuthor is the author of a Git commit.
|
||||
|
@ -49,6 +49,14 @@ scoop:
|
||||
persist:
|
||||
- "data"
|
||||
- "config.toml"
|
||||
|
||||
# An array of commands to be executed before an application is installed.
|
||||
# Default is empty.
|
||||
pre_install: ["Write-Host 'Running preinstall command'"]
|
||||
|
||||
# An array of commands to be executed after an application is installed.
|
||||
# Default is empty.
|
||||
post_install: ["Write-Host 'Running postinstall command'"]
|
||||
```
|
||||
|
||||
By defining the `scoop` section, GoReleaser will take care of publishing the
|
||||
|
Loading…
x
Reference in New Issue
Block a user