mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-03-17 20:47:50 +02:00
When submitting a new project to chocolatey using goreleaser, a reviewer told me that a line in the template is incorrect: <img width="1054" alt="image" src="https://github.com/user-attachments/assets/423c4493-85fa-4cc5-8a74-97d2a561743b"> <img width="1052" alt="image" src="https://github.com/user-attachments/assets/04425da1-eb90-4504-9308-9a2e49ca85d8"> > since that is not a valid parameter to the Install-ChocolateyZipPackage function: https://docs.chocolatey.org/en-us/create/functions/install-chocolateyzippackage/ This PR aims to correct that by removing the line from the template as requested
38 lines
944 B
Go
38 lines
944 B
Go
package chocolatey
|
|
|
|
type templateData struct {
|
|
Packages []releasePackage
|
|
}
|
|
|
|
type releasePackage struct {
|
|
DownloadURL string
|
|
Checksum string
|
|
Arch string
|
|
}
|
|
|
|
const scriptTemplate = `# This file was generated by GoReleaser. DO NOT EDIT.
|
|
$ErrorActionPreference = 'Stop';
|
|
|
|
$version = $env:chocolateyPackageVersion
|
|
$packageName = $env:chocolateyPackageName
|
|
$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
|
|
|
|
$packageArgs = @{
|
|
packageName = $packageName
|
|
unzipLocation = $toolsDir
|
|
{{- range $release := .Packages }}
|
|
{{- if eq $release.Arch "amd64" }}
|
|
url64bit = '{{ $release.DownloadURL }}'
|
|
checksum64 = '{{ $release.Checksum }}'
|
|
checksumType64 = 'sha256'
|
|
{{- else }}
|
|
url = '{{ $release.DownloadURL }}'
|
|
checksum = '{{ $release.Checksum }}'
|
|
checksumType = 'sha256'
|
|
{{- end }}
|
|
{{- end }}
|
|
}
|
|
|
|
Install-ChocolateyZipPackage @packageArgs
|
|
`
|