github.com/goreleaser/goreleaser@v1.25.1/internal/pipe/chocolatey/template.go (about)

     1  package chocolatey
     2  
     3  type templateData struct {
     4  	Packages []releasePackage
     5  }
     6  
     7  type releasePackage struct {
     8  	DownloadURL string
     9  	Checksum    string
    10  	Arch        string
    11  }
    12  
    13  const scriptTemplate = `# This file was generated by GoReleaser. DO NOT EDIT.
    14  $ErrorActionPreference = 'Stop';
    15  
    16  $version = $env:chocolateyPackageVersion
    17  $packageName = $env:chocolateyPackageName
    18  $toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
    19  
    20  $packageArgs = @{
    21      packageName    = $packageName
    22      unzipLocation  = $toolsDir
    23      fileType       = 'exe'
    24      {{- range $release := .Packages }}
    25      {{- if eq $release.Arch "amd64" }}
    26      url64bit       = '{{ $release.DownloadURL }}'
    27      checksum64     = '{{ $release.Checksum }}'
    28      checksumType64 = 'sha256'
    29      {{- else }}
    30      url            = '{{ $release.DownloadURL }}'
    31      checksum       = '{{ $release.Checksum }}'
    32      checksumType   = 'sha256'
    33      {{- end }}
    34      {{- end }}
    35  }
    36  
    37  Install-ChocolateyZipPackage @packageArgs
    38  `