mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-01-24 04:16:27 +02:00
chore: improving scoop code a bit
This commit is contained in:
parent
1376f9e226
commit
851fd76a5e
@ -80,7 +80,8 @@ func doRun(ctx *context.Context, client client.Client) error {
|
|||||||
ctx.Config.Scoop.CommitAuthor,
|
ctx.Config.Scoop.CommitAuthor,
|
||||||
ctx.Config.Scoop.Bucket,
|
ctx.Config.Scoop.Bucket,
|
||||||
content,
|
content,
|
||||||
path)
|
path,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Manifest represents a scoop.sh App Manifest, more info:
|
// Manifest represents a scoop.sh App Manifest, more info:
|
||||||
@ -109,17 +110,14 @@ func buildManifest(ctx *context.Context, client client.Client, artifacts []artif
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, artifact := range artifacts {
|
for _, artifact := range artifacts {
|
||||||
if artifact.Goarch == "amd64" {
|
var arch = "64bit"
|
||||||
manifest.Architecture["64bit"] = Resource{
|
if artifact.Goarch == "386" {
|
||||||
|
arch = "32bit"
|
||||||
|
}
|
||||||
|
manifest.Architecture[arch] = Resource{
|
||||||
URL: getDownloadURL(ctx, ctx.Config.GitHubURLs.Download, artifact.Name),
|
URL: getDownloadURL(ctx, ctx.Config.GitHubURLs.Download, artifact.Name),
|
||||||
Bin: ctx.Config.Builds[0].Binary + ".exe",
|
Bin: ctx.Config.Builds[0].Binary + ".exe",
|
||||||
}
|
}
|
||||||
} else if artifact.Goarch == "386" {
|
|
||||||
manifest.Architecture["32bit"] = Resource{
|
|
||||||
URL: getDownloadURL(ctx, ctx.Config.GitHubURLs.Download, artifact.Name),
|
|
||||||
Bin: ctx.Config.Builds[0].Binary + ".exe",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
data, err := json.MarshalIndent(manifest, "", " ")
|
data, err := json.MarshalIndent(manifest, "", " ")
|
||||||
@ -127,15 +125,16 @@ func buildManifest(ctx *context.Context, client client.Client, artifacts []artif
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
_, err = result.Write(data)
|
_, err = result.Write(data)
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func getDownloadURL(ctx *context.Context, githubURL, file string) (url string) {
|
func getDownloadURL(ctx *context.Context, githubURL, file string) string {
|
||||||
return fmt.Sprintf("%s/%s/%s/releases/download/%s/%s",
|
return fmt.Sprintf(
|
||||||
|
"%s/%s/%s/releases/download/%s/%s",
|
||||||
githubURL,
|
githubURL,
|
||||||
ctx.Config.Release.GitHub.Owner,
|
ctx.Config.Release.GitHub.Owner,
|
||||||
ctx.Config.Release.GitHub.Name,
|
ctx.Config.Release.GitHub.Name,
|
||||||
ctx.Version,
|
ctx.Version,
|
||||||
file)
|
file,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user