Merge v2.10 into v3.0
This commit is contained in:
commit
286181aa61
62 changed files with 712 additions and 189 deletions
41
internal/release/release.go
Normal file
41
internal/release/release.go
Normal file
|
@ -0,0 +1,41 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"path"
|
||||
"strings"
|
||||
"text/template"
|
||||
)
|
||||
|
||||
func main() {
|
||||
if len(os.Args) < 2 {
|
||||
log.Fatal("GOOS should be provided as a CLI argument")
|
||||
}
|
||||
|
||||
goos := strings.TrimSpace(os.Args[1])
|
||||
if goos == "" {
|
||||
log.Fatal("GOOS should be provided as a CLI argument")
|
||||
}
|
||||
|
||||
tmpl := template.Must(
|
||||
template.New(".goreleaser.yml.tmpl").
|
||||
Delims("[[", "]]").
|
||||
ParseFiles("./.goreleaser.yml.tmpl"),
|
||||
)
|
||||
|
||||
outputPath := path.Join(os.TempDir(), fmt.Sprintf(".goreleaser_%s.yml", goos))
|
||||
|
||||
output, err := os.Create(outputPath)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
err = tmpl.Execute(output, map[string]string{"GOOS": goos})
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
fmt.Print(outputPath)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue