-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci(release): Update Homebrew tap on release
- Loading branch information
Showing
6 changed files
with
153 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
cask "gones" do | ||
desc "An NES emulator written in Go." | ||
homepage "https://github.com/gabe565/gones" | ||
{{- if eq .Version "latest" }} | ||
version :latest | ||
{{- else }} | ||
version "{{ trimPrefix "v" .Version }}" | ||
{{- end }} | ||
|
||
url "https://github.com/gabe565/gones/releases/download/{{ .Version }}/gones_darwin.tar.gz" | ||
sha256 "{{ .SHA256 }}" | ||
|
||
app "GoNES.app" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package main | ||
|
||
import ( | ||
"crypto/sha256" | ||
_ "embed" | ||
"encoding/hex" | ||
"io" | ||
"os" | ||
"strings" | ||
"text/template" | ||
|
||
"github.com/Masterminds/sprig/v3" | ||
flag "github.com/spf13/pflag" | ||
) | ||
|
||
//go:embed gones.rb.tmpl | ||
var spec string | ||
|
||
type SpecVars struct { | ||
Path string | ||
Version string | ||
SHA256 string | ||
} | ||
|
||
func main() { | ||
var values SpecVars | ||
flag.StringVar(&values.Path, "path", "", "Binary path") | ||
flag.StringVar(&values.Version, "version", "", "Version") | ||
flag.Parse() | ||
|
||
tmpl, err := template.New("").Funcs(sprig.TxtFuncMap()).Parse(spec) | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
binary, err := os.Open(values.Path) | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
h := sha256.New() | ||
if _, err := io.Copy(h, binary); err != nil { | ||
panic(err) | ||
} | ||
_ = binary.Close() | ||
values.SHA256 = hex.EncodeToString(h.Sum(nil)) | ||
|
||
var buf strings.Builder | ||
if err := tmpl.Execute(&buf, values); err != nil { | ||
panic(err) | ||
} | ||
|
||
_, _ = io.WriteString(os.Stdout, buf.String()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters