From bbcb2f6eb6f03f7d91229aa01ab652b663431394 Mon Sep 17 00:00:00 2001 From: Alex Gherasie <68433935+agherasie@users.noreply.github.com> Date: Wed, 7 Aug 2024 16:14:51 +0300 Subject: [PATCH 1/4] feat(gnoweb): added link to readme if present (#2461) Added a link to the `README.md` file of the realm if it exists ![image](https://github.com/gnolang/gno/assets/68433935/8259ebd7-9a15-4647-9280-80618f870fcc) To allow for quicker access while browsing gnoweb This should solve https://github.com/gnolang/gno/issues/2458
Contributors' checklist... - [x] Added new tests, or not needed, or not feasible - [x] Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory - [x] Updated the official documentation or not needed - [x] No breaking changes were made, or a `BREAKING CHANGE: xxx` message was included in the description - [x] Added references to related issues and PRs - [ ] Provided any useful hints for running manual tests - [ ] Added new benchmarks to [generated graphs](https://gnoland.github.io/benchmarks), if any. More info [here](https://github.com/gnolang/gno/blob/master/.benchmarks/README.md).
--------- Co-authored-by: Lee ByeongJun Co-authored-by: Guilhem Fanton <8671905+gfanton@users.noreply.github.com> --- gno.land/pkg/gnoweb/gnoweb.go | 11 +++++++++++ gno.land/pkg/gnoweb/views/realm_render.html | 3 +++ 2 files changed, 14 insertions(+) diff --git a/gno.land/pkg/gnoweb/gnoweb.go b/gno.land/pkg/gnoweb/gnoweb.go index b997de7840d..1cd0d664193 100644 --- a/gno.land/pkg/gnoweb/gnoweb.go +++ b/gno.land/pkg/gnoweb/gnoweb.go @@ -1,6 +1,7 @@ package gnoweb import ( + "bytes" "embed" "encoding/json" "errors" @@ -335,6 +336,15 @@ func handleRealmRender(logger *slog.Logger, app gotuna.App, cfg *Config, w http. return } } + + dirdata := []byte(rlmpath) + dirres, err := makeRequest(logger, cfg, qFileStr, dirdata) + if err != nil { + writeError(logger, w, err) + return + } + hasReadme := bytes.Contains(append(dirres.Data, '\n'), []byte("README.md\n")) + // linkify querystr. queryParts := strings.Split(querystr, "/") pathLinks := []pathLink{} @@ -354,6 +364,7 @@ func handleRealmRender(logger *slog.Logger, app gotuna.App, cfg *Config, w http. tmpl.Set("PathLinks", pathLinks) tmpl.Set("Contents", string(res.Data)) tmpl.Set("Config", cfg) + tmpl.Set("HasReadme", hasReadme) tmpl.Render(w, r, "realm_render.html", "funcs.html") } diff --git a/gno.land/pkg/gnoweb/views/realm_render.html b/gno.land/pkg/gnoweb/views/realm_render.html index 9a4507777a6..924ef2b414f 100644 --- a/gno.land/pkg/gnoweb/views/realm_render.html +++ b/gno.land/pkg/gnoweb/views/realm_render.html @@ -16,6 +16,9 @@ {{- end -}} + {{ if .Data.HasReadme }} + [readme] + {{ end }} [source] [help] From 36c8b03bb5e6b8e4b4de1c5b5b7b6482d1a81498 Mon Sep 17 00:00:00 2001 From: Guilhem Fanton <8671905+gfanton@users.noreply.github.com> Date: Fri, 9 Aug 2024 15:22:35 +0200 Subject: [PATCH 2/4] feat(gnoland): Improve `gnoland config/secrets` command description (#2399) --- gno.land/cmd/gnoland/config_get.go | 13 +++ gno.land/cmd/gnoland/config_help.go | 127 ++++++++++++++++++++++++++++ gno.land/cmd/gnoland/config_set.go | 12 +++ gno.land/cmd/gnoland/secrets_get.go | 12 +++ 4 files changed, 164 insertions(+) create mode 100644 gno.land/cmd/gnoland/config_help.go diff --git a/gno.land/cmd/gnoland/config_get.go b/gno.land/cmd/gnoland/config_get.go index 1fd4027ec60..796ae9da5e9 100644 --- a/gno.land/cmd/gnoland/config_get.go +++ b/gno.land/cmd/gnoland/config_get.go @@ -36,6 +36,19 @@ func newConfigGetCmd(io commands.IO) *commands.Command { }, ) + // Add subcommand helpers + helperGen := metadataHelperGenerator{ + MetaUpdate: func(meta *commands.Metadata, inputType string) { + meta.ShortUsage = fmt.Sprintf("config get %s <%s>", meta.Name, inputType) + }, + TagNameSelector: "json", + TreeDisplay: true, + } + subs := generateSubCommandHelper(helperGen, config.Config{}, func(_ context.Context, args []string) error { + return execConfigGet(cfg, io, args) + }) + + cmd.AddSubCommands(subs...) return cmd } diff --git a/gno.land/cmd/gnoland/config_help.go b/gno.land/cmd/gnoland/config_help.go new file mode 100644 index 00000000000..97d43953bba --- /dev/null +++ b/gno.land/cmd/gnoland/config_help.go @@ -0,0 +1,127 @@ +package main + +import ( + "context" + "fmt" + "reflect" + "strings" + "unicode" + + "github.com/gnolang/gno/tm2/pkg/commands" +) + +type metadataHelperGenerator struct { + // Optional callback to edit metadata + MetaUpdate func(meta *commands.Metadata, inputType string) + // Tag to select for name, if empty will use the field Name + TagNameSelector string + // Will display description with tree representation + TreeDisplay bool +} + +// generateSubCommandHelper generates subcommands based on `s` structure fields and their respective tag descriptions +func generateSubCommandHelper(gen metadataHelperGenerator, s any, exec commands.ExecMethod) []*commands.Command { + rv := reflect.ValueOf(s) + metas := gen.generateFields(rv, "", 0) + + cmds := make([]*commands.Command, len(metas)) + for i := 0; i < len(metas); i++ { + meta := metas[i] + exec := func(ctx context.Context, args []string) error { + args = append([]string{meta.Name}, args...) + return exec(ctx, args) + } + cmds[i] = commands.NewCommand(meta, nil, exec) + } + + return cmds +} + +func (g *metadataHelperGenerator) generateFields(rv reflect.Value, parent string, depth int) []commands.Metadata { + if parent != "" { + parent += "." + } + + // Unwrap pointer if needed + if rv.Kind() == reflect.Ptr { + if rv.IsNil() { + // Create a new non-nil instance of the original type that was nil + rv = reflect.New(rv.Type().Elem()) + } + rv = rv.Elem() // Dereference to struct value + } + + metas := []commands.Metadata{} + if rv.Kind() != reflect.Struct { + return metas + } + + rt := rv.Type() + for i := 0; i < rv.NumField(); i++ { + field := rt.Field(i) + if !field.IsExported() { + continue + } + + fieldValue := rv.Field(i) + name := field.Name + // Get JSON tag name + if g.TagNameSelector != "" { + name, _, _ = strings.Cut(field.Tag.Get(g.TagNameSelector), ",") + if name == "" || name == "-" { + continue + } + } + + // Recursive call for nested struct + var childs []commands.Metadata + if k := fieldValue.Kind(); k == reflect.Ptr || k == reflect.Struct { + childs = g.generateFields(fieldValue, name, depth+1) + } + + // Generate metadata + var meta commands.Metadata + + // Name + meta.Name = parent + name + + // Create a tree-like display to see nested field + if g.TreeDisplay && depth > 0 { + meta.ShortHelp += strings.Repeat(" ", depth*2) + if i == rv.NumField()-1 { + meta.ShortHelp += "└─" + } else { + meta.ShortHelp += "├─" + } + } + meta.ShortHelp += fmt.Sprintf("<%s>", field.Type) + + // Get Short/Long Help Message from comment tag + comment := field.Tag.Get("comment") + comment = strings.TrimFunc(comment, func(r rune) bool { + return unicode.IsSpace(r) || r == '#' + }) + + if comment != "" { + // Use the first line as short help + meta.ShortHelp += " " + meta.ShortHelp += strings.Split(comment, "\n")[0] + + // Display full comment as Long Help + meta.LongHelp = comment + } else { + // If the comment is empty, it mostly means that there is no help. + // Use a blank space to avoid falling back on short help. + meta.LongHelp = " " + } + + if g.MetaUpdate != nil { + g.MetaUpdate(&meta, field.Type.String()) + } + + metas = append(metas, meta) + metas = append(metas, childs...) + } + + return metas +} diff --git a/gno.land/cmd/gnoland/config_set.go b/gno.land/cmd/gnoland/config_set.go index dd171970bf6..de96aa35c7d 100644 --- a/gno.land/cmd/gnoland/config_set.go +++ b/gno.land/cmd/gnoland/config_set.go @@ -34,6 +34,18 @@ func newConfigSetCmd(io commands.IO) *commands.Command { }, ) + // Add subcommand helpers + helperGen := metadataHelperGenerator{ + MetaUpdate: func(meta *commands.Metadata, inputType string) { + meta.ShortUsage = fmt.Sprintf("config set %s <%s>", meta.Name, inputType) + }, + TagNameSelector: "json", + TreeDisplay: true, + } + cmd.AddSubCommands(generateSubCommandHelper(helperGen, config.Config{}, func(_ context.Context, args []string) error { + return execConfigEdit(cfg, io, args) + })...) + return cmd } diff --git a/gno.land/cmd/gnoland/secrets_get.go b/gno.land/cmd/gnoland/secrets_get.go index 47de7a46283..8d111516816 100644 --- a/gno.land/cmd/gnoland/secrets_get.go +++ b/gno.land/cmd/gnoland/secrets_get.go @@ -41,6 +41,18 @@ func newSecretsGetCmd(io commands.IO) *commands.Command { }, ) + // Add subcommand helpers + helperGen := metadataHelperGenerator{ + MetaUpdate: func(meta *commands.Metadata, inputType string) { + meta.ShortUsage = fmt.Sprintf("secrets get %s <%s>", meta.Name, inputType) + }, + TagNameSelector: "json", + TreeDisplay: false, + } + cmd.AddSubCommands(generateSubCommandHelper(helperGen, secrets{}, func(_ context.Context, args []string) error { + return execSecretsGet(cfg, args, io) + })...) + return cmd } From bd99fbeb47eda3ab22bf0c7ca2558d2c5eea3adb Mon Sep 17 00:00:00 2001 From: Manfred Touron <94029+moul@users.noreply.github.com> Date: Fri, 9 Aug 2024 13:00:12 -0700 Subject: [PATCH 3/4] feat: add p/demo/entropy (#2487) - Revert partially "feat(stdlibs): add math/rand (#2455) (f547d7dcac11de7937664413497fed35eb1a03ff) - Update p/demo/rand and rename to p/demo/entropy --------- Signed-off-by: moul <94029+moul@users.noreply.github.com> Co-authored-by: Marc Vertes --- examples/gno.land/p/demo/entropy/entropy.gno | 89 +++++++++++++++++++ .../gno.land/p/demo/entropy/entropy_test.gno | 46 ++++++++++ examples/gno.land/p/demo/entropy/gno.mod | 1 + .../gno.land/p/demo/entropy/z_filetest.gno | 56 ++++++++++++ examples/gno.land/r/demo/art/gnoface/gno.mod | 1 + .../gno.land/r/demo/art/gnoface/gnoface.gno | 4 +- 6 files changed, 195 insertions(+), 2 deletions(-) create mode 100644 examples/gno.land/p/demo/entropy/entropy.gno create mode 100644 examples/gno.land/p/demo/entropy/entropy_test.gno create mode 100644 examples/gno.land/p/demo/entropy/gno.mod create mode 100644 examples/gno.land/p/demo/entropy/z_filetest.gno diff --git a/examples/gno.land/p/demo/entropy/entropy.gno b/examples/gno.land/p/demo/entropy/entropy.gno new file mode 100644 index 00000000000..5e35b8c7227 --- /dev/null +++ b/examples/gno.land/p/demo/entropy/entropy.gno @@ -0,0 +1,89 @@ +// Entropy generates fully deterministic, cost-effective, and hard to guess +// numbers. +// +// It is designed both for single-usage, like seeding math/rand or for being +// reused which increases the entropy and its cost effectiveness. +// +// Disclaimer: this package is unsafe and won't prevent others to guess values +// in advance. +// +// It uses the Bernstein's hash djb2 to be CPU-cycle efficient. +package entropy + +import ( + "math" + "std" + "time" +) + +type Instance struct { + value uint32 +} + +func New() *Instance { + r := Instance{value: 5381} + r.addEntropy() + return &r +} + +func FromSeed(seed uint32) *Instance { + r := Instance{value: seed} + r.addEntropy() + return &r +} + +func (i *Instance) Seed() uint32 { + return i.value +} + +func (i *Instance) djb2String(input string) { + for _, c := range input { + i.djb2Uint32(uint32(c)) + } +} + +// super fast random algorithm. +// http://www.cse.yorku.ca/~oz/hash.html +func (i *Instance) djb2Uint32(input uint32) { + i.value = (i.value << 5) + i.value + input +} + +// AddEntropy uses various runtime variables to add entropy to the existing seed. +func (i *Instance) addEntropy() { + // FIXME: reapply the 5381 initial value? + + // inherit previous entropy + // nothing to do + + // handle callers + { + caller1 := std.GetCallerAt(1).String() + i.djb2String(caller1) + caller2 := std.GetCallerAt(2).String() + i.djb2String(caller2) + } + + // height + { + height := std.GetHeight() + if height >= math.MaxUint32 { + height -= math.MaxUint32 + } + i.djb2Uint32(uint32(height)) + } + + // time + { + secs := time.Now().Second() + i.djb2Uint32(uint32(secs)) + nsecs := time.Now().Nanosecond() + i.djb2Uint32(uint32(nsecs)) + } + + // FIXME: compute other hard-to-guess but deterministic variables, like real gas? +} + +func (i *Instance) Value() uint32 { + i.addEntropy() + return i.value +} diff --git a/examples/gno.land/p/demo/entropy/entropy_test.gno b/examples/gno.land/p/demo/entropy/entropy_test.gno new file mode 100644 index 00000000000..0deb3ab9aa2 --- /dev/null +++ b/examples/gno.land/p/demo/entropy/entropy_test.gno @@ -0,0 +1,46 @@ +package entropy + +import ( + "std" + "strconv" + "testing" +) + +func TestInstance(t *testing.T) { + instance := New() + if instance == nil { + t.Errorf("instance should not be nil") + } +} + +func TestInstanceValue(t *testing.T) { + baseEntropy := New() + baseResult := computeValue(t, baseEntropy) + + sameHeightEntropy := New() + sameHeightResult := computeValue(t, sameHeightEntropy) + + if baseResult != sameHeightResult { + t.Errorf("should have the same result: new=%s, base=%s", sameHeightResult, baseResult) + } + + std.TestSkipHeights(1) + differentHeightEntropy := New() + differentHeightResult := computeValue(t, differentHeightEntropy) + + if baseResult == differentHeightResult { + t.Errorf("should have different result: new=%s, base=%s", differentHeightResult, baseResult) + } +} + +func computeValue(t *testing.T, r *Instance) string { + t.Helper() + + out := "" + for i := 0; i < 10; i++ { + val := int(r.Value()) + out += strconv.Itoa(val) + " " + } + + return out +} diff --git a/examples/gno.land/p/demo/entropy/gno.mod b/examples/gno.land/p/demo/entropy/gno.mod new file mode 100644 index 00000000000..9a6db8f5b61 --- /dev/null +++ b/examples/gno.land/p/demo/entropy/gno.mod @@ -0,0 +1 @@ +module gno.land/p/demo/entropy diff --git a/examples/gno.land/p/demo/entropy/z_filetest.gno b/examples/gno.land/p/demo/entropy/z_filetest.gno new file mode 100644 index 00000000000..85ed1b10a3d --- /dev/null +++ b/examples/gno.land/p/demo/entropy/z_filetest.gno @@ -0,0 +1,56 @@ +package main + +import ( + "std" + + "gno.land/p/demo/entropy" +) + +func main() { + // initial + println("---") + r := entropy.New() + println(r.Value()) + println(r.Value()) + println(r.Value()) + println(r.Value()) + println(r.Value()) + + // should be the same + println("---") + r = entropy.New() + println(r.Value()) + println(r.Value()) + println(r.Value()) + println(r.Value()) + println(r.Value()) + + std.TestSkipHeights(1) + println("---") + r = entropy.New() + println(r.Value()) + println(r.Value()) + println(r.Value()) + println(r.Value()) + println(r.Value()) +} + +// Output: +// --- +// 4129293727 +// 2141104956 +// 1950222777 +// 3348280598 +// 438354259 +// --- +// 4129293727 +// 2141104956 +// 1950222777 +// 3348280598 +// 438354259 +// --- +// 49506731 +// 1539580078 +// 2695928529 +// 1895482388 +// 3462727799 diff --git a/examples/gno.land/r/demo/art/gnoface/gno.mod b/examples/gno.land/r/demo/art/gnoface/gno.mod index eb6f44d4026..072c98f3bd6 100644 --- a/examples/gno.land/r/demo/art/gnoface/gno.mod +++ b/examples/gno.land/r/demo/art/gnoface/gno.mod @@ -1,6 +1,7 @@ module gno.land/r/demo/art/gnoface require ( + gno.land/p/demo/entropy v0.0.0-latest gno.land/p/demo/uassert v0.0.0-latest gno.land/p/demo/ufmt v0.0.0-latest ) diff --git a/examples/gno.land/r/demo/art/gnoface/gnoface.gno b/examples/gno.land/r/demo/art/gnoface/gnoface.gno index 9e85c5c7387..b4bc8e222e5 100644 --- a/examples/gno.land/r/demo/art/gnoface/gnoface.gno +++ b/examples/gno.land/r/demo/art/gnoface/gnoface.gno @@ -2,15 +2,15 @@ package gnoface import ( "math/rand" - "std" "strconv" "strings" + "gno.land/p/demo/entropy" "gno.land/p/demo/ufmt" ) func Render(path string) string { - seed := uint64(std.GetHeight()) + seed := uint64(entropy.New().Value()) path = strings.TrimSpace(path) if path != "" { From ff0c177b984ec0a6a483ea09095c0aa3e639623d Mon Sep 17 00:00:00 2001 From: Sergio Maria Matone Date: Mon, 12 Aug 2024 18:50:24 +0200 Subject: [PATCH 4/4] ci: Full revision of Goreleaser tasks (#2672) This PR has different purposes: * adding Gnofaucet to Goreleaser task (closes #2557) * moving Goreleaser from v 1.26 to v 2.1 * reducing the verbosity of tasks by merging the different release types (latest, nightly, master) into a single goreleaser file * adding a fallbacked env variable called `TAG_VERSION`, which label the various docker images * adding the `nightly` subtask, which is ignored for latest releases * skipping publish for master release (NOTE: this part is the one TBC, because `master` release is using nightly too, but the variable `tag_name` unfortunately cannot be templated, let's see if it can make sense or if there is another workaround)
Contributors' checklist... - [x] Added new tests, or not needed, or not feasible - [x] Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory - [x] Updated the official documentation or not needed - [x] No breaking changes were made, or a `BREAKING CHANGE: xxx` message was included in the description - [x] Added references to related issues and PRs - [x] Provided any useful hints for running manual tests - [x] Added new benchmarks to [generated graphs](https://gnoland.github.io/benchmarks), if any. More info [here](https://github.com/gnolang/gno/blob/master/.benchmarks/README.md).
--- .github/goreleaser.yaml | 187 ++++++++++++++++++++------ .github/workflows/nightlies.yml | 5 +- .github/workflows/releaser-master.yml | 5 +- .github/workflows/releaser.yml | 2 +- Dockerfile.release | 7 + 5 files changed, 163 insertions(+), 43 deletions(-) diff --git a/.github/goreleaser.yaml b/.github/goreleaser.yaml index ab98aa92555..bf99a91feeb 100644 --- a/.github/goreleaser.yaml +++ b/.github/goreleaser.yaml @@ -1,4 +1,10 @@ project_name: gno +version: 2 + +env: + - TAG_VERSION={{ if index .Env "TAG_VERSION" }}{{ .Env.TAG_VERSION }}{{ else }}latest{{ end }} + # supported in next versions -> https://github.com/goreleaser/goreleaser/issues/5059 + # - TAG_VERSION="{{ envOrDefault "TAG_VERSION" "latest" }}" before: hooks: @@ -65,6 +71,22 @@ builds: goarm: - 6 - 7 + - id: gnofaucet + dir: ./contribs/gnofaucet + binary: gnofaucet + env: + - CGO_ENABLED=0 + goos: + - linux + - darwin + goarch: + - amd64 + - arm64 + - arm + goarm: + - 6 + - 7 + gomod: proxy: true @@ -99,7 +121,7 @@ dockers: goarch: amd64 image_templates: - "ghcr.io/gnolang/{{ .ProjectName }}:{{ .Version }}-amd64" - - "ghcr.io/gnolang/{{ .ProjectName }}:latest-amd64" + - "ghcr.io/gnolang/{{ .ProjectName }}:{{ .Env.TAG_VERSION }}-amd64" build_flag_templates: - "--target=gno" - "--platform=linux/amd64" @@ -119,7 +141,7 @@ dockers: goarch: arm64 image_templates: - "ghcr.io/gnolang/{{ .ProjectName }}:{{ .Version }}-arm64v8" - - "ghcr.io/gnolang/{{ .ProjectName }}:latest-arm64v8" + - "ghcr.io/gnolang/{{ .ProjectName }}:{{ .Env.TAG_VERSION }}-arm64v8" build_flag_templates: - "--target=gno" - "--platform=linux/arm64/v8" @@ -140,7 +162,7 @@ dockers: goarm: 6 image_templates: - "ghcr.io/gnolang/{{ .ProjectName }}:{{ .Version }}-armv6" - - "ghcr.io/gnolang/{{ .ProjectName }}:latest-armv6" + - "ghcr.io/gnolang/{{ .ProjectName }}:{{ .Env.TAG_VERSION }}-armv6" build_flag_templates: - "--target=gno" - "--platform=linux/arm/v6" @@ -161,7 +183,7 @@ dockers: goarm: 7 image_templates: - "ghcr.io/gnolang/{{ .ProjectName }}:{{ .Version }}-armv7" - - "ghcr.io/gnolang/{{ .ProjectName }}:latest-armv7" + - "ghcr.io/gnolang/{{ .ProjectName }}:{{ .Env.TAG_VERSION }}-armv7" build_flag_templates: - "--target=gno" - "--platform=linux/arm/v7" @@ -183,7 +205,7 @@ dockers: goarch: amd64 image_templates: - "ghcr.io/gnolang/{{ .ProjectName }}/gnoland:{{ .Version }}-amd64" - - "ghcr.io/gnolang/{{ .ProjectName }}/gnoland:latest-amd64" + - "ghcr.io/gnolang/{{ .ProjectName }}/gnoland:{{ .Env.TAG_VERSION }}-amd64" build_flag_templates: - "--target=gnoland" - "--platform=linux/amd64" @@ -204,7 +226,7 @@ dockers: goarch: arm64 image_templates: - "ghcr.io/gnolang/{{ .ProjectName }}/gnoland:{{ .Version }}-arm64v8" - - "ghcr.io/gnolang/{{ .ProjectName }}/gnoland:latest-arm64v8" + - "ghcr.io/gnolang/{{ .ProjectName }}/gnoland:{{ .Env.TAG_VERSION }}-arm64v8" build_flag_templates: - "--target=gnoland" - "--platform=linux/arm64/v8" @@ -226,7 +248,7 @@ dockers: goarm: 6 image_templates: - "ghcr.io/gnolang/{{ .ProjectName }}/gnoland:{{ .Version }}-armv6" - - "ghcr.io/gnolang/{{ .ProjectName }}/gnoland:latest-armv6" + - "ghcr.io/gnolang/{{ .ProjectName }}/gnoland:{{ .Env.TAG_VERSION }}-armv6" build_flag_templates: - "--target=gnoland" - "--platform=linux/arm/v6" @@ -248,7 +270,7 @@ dockers: goarm: 7 image_templates: - "ghcr.io/gnolang/{{ .ProjectName }}/gnoland:{{ .Version }}-armv7" - - "ghcr.io/gnolang/{{ .ProjectName }}/gnoland:latest-armv7" + - "ghcr.io/gnolang/{{ .ProjectName }}/gnoland:{{ .Env.TAG_VERSION }}-armv7" build_flag_templates: - "--target=gnoland" - "--platform=linux/arm/v7" @@ -270,7 +292,7 @@ dockers: goarch: amd64 image_templates: - "ghcr.io/gnolang/{{ .ProjectName }}/gnokey:{{ .Version }}-amd64" - - "ghcr.io/gnolang/{{ .ProjectName }}/gnokey:latest-amd64" + - "ghcr.io/gnolang/{{ .ProjectName }}/gnokey:{{ .Env.TAG_VERSION }}-amd64" build_flag_templates: - "--target=gnokey" - "--platform=linux/amd64" @@ -286,7 +308,7 @@ dockers: goarch: arm64 image_templates: - "ghcr.io/gnolang/{{ .ProjectName }}/gnokey:{{ .Version }}-arm64v8" - - "ghcr.io/gnolang/{{ .ProjectName }}/gnokey:latest-arm64v8" + - "ghcr.io/gnolang/{{ .ProjectName }}/gnokey:{{ .Env.TAG_VERSION }}-arm64v8" build_flag_templates: - "--target=gnokey" - "--platform=linux/arm64/v8" @@ -303,7 +325,7 @@ dockers: goarm: 6 image_templates: - "ghcr.io/gnolang/{{ .ProjectName }}/gnokey:{{ .Version }}-armv6" - - "ghcr.io/gnolang/{{ .ProjectName }}/gnokey:latest-armv6" + - "ghcr.io/gnolang/{{ .ProjectName }}/gnokey:{{ .Env.TAG_VERSION }}-armv6" build_flag_templates: - "--target=gnokey" - "--platform=linux/arm/v6" @@ -320,7 +342,7 @@ dockers: goarm: 7 image_templates: - "ghcr.io/gnolang/{{ .ProjectName }}/gnokey:{{ .Version }}-armv7" - - "ghcr.io/gnolang/{{ .ProjectName }}/gnokey:latest-armv7" + - "ghcr.io/gnolang/{{ .ProjectName }}/gnokey:{{ .Env.TAG_VERSION }}-armv7" build_flag_templates: - "--target=gnokey" - "--platform=linux/arm/v7" @@ -338,7 +360,7 @@ dockers: goarch: amd64 image_templates: - "ghcr.io/gnolang/{{ .ProjectName }}/gnoweb:{{ .Version }}-amd64" - - "ghcr.io/gnolang/{{ .ProjectName }}/gnoweb:latest-amd64" + - "ghcr.io/gnolang/{{ .ProjectName }}/gnoweb:{{ .Env.TAG_VERSION }}-amd64" build_flag_templates: - "--target=gnoweb" - "--platform=linux/amd64" @@ -354,7 +376,7 @@ dockers: goarch: arm64 image_templates: - "ghcr.io/gnolang/{{ .ProjectName }}/gnoweb:{{ .Version }}-arm64v8" - - "ghcr.io/gnolang/{{ .ProjectName }}/gnoweb:latest-arm64v8" + - "ghcr.io/gnolang/{{ .ProjectName }}/gnoweb:{{ .Env.TAG_VERSION }}-arm64v8" build_flag_templates: - "--target=gnoweb" - "--platform=linux/arm64/v8" @@ -371,7 +393,7 @@ dockers: goarm: 6 image_templates: - "ghcr.io/gnolang/{{ .ProjectName }}/gnoweb:{{ .Version }}-armv6" - - "ghcr.io/gnolang/{{ .ProjectName }}/gnoweb:latest-armv6" + - "ghcr.io/gnolang/{{ .ProjectName }}/gnoweb:{{ .Env.TAG_VERSION }}-armv6" build_flag_templates: - "--target=gnoweb" - "--platform=linux/arm/v6" @@ -388,7 +410,7 @@ dockers: goarm: 7 image_templates: - "ghcr.io/gnolang/{{ .ProjectName }}/gnoweb:{{ .Version }}-armv7" - - "ghcr.io/gnolang/{{ .ProjectName }}/gnoweb:latest-armv7" + - "ghcr.io/gnolang/{{ .ProjectName }}/gnoweb:{{ .Env.TAG_VERSION }}-armv7" build_flag_templates: - "--target=gnoweb" - "--platform=linux/arm/v7" @@ -399,6 +421,74 @@ dockers: ids: - gnoweb + # gnofaucet + - use: buildx + dockerfile: Dockerfile.release + goos: linux + goarch: amd64 + image_templates: + - "ghcr.io/gnolang/{{ .ProjectName }}/gnofaucet:{{ .Version }}-amd64" + - "ghcr.io/gnolang/{{ .ProjectName }}/gnofaucet:{{ .Env.TAG_VERSION }}-amd64" + build_flag_templates: + - "--target=gnofaucet" + - "--platform=linux/amd64" + - "--label=org.opencontainers.image.created={{.Date}}" + - "--label=org.opencontainers.image.title={{.ProjectName}}/gnofaucet" + - "--label=org.opencontainers.image.revision={{.FullCommit}}" + - "--label=org.opencontainers.image.version={{.Version}}" + ids: + - gnofaucet + - use: buildx + dockerfile: Dockerfile.release + goos: linux + goarch: arm64 + image_templates: + - "ghcr.io/gnolang/{{ .ProjectName }}/gnofaucet:{{ .Version }}-arm64v8" + - "ghcr.io/gnolang/{{ .ProjectName }}/gnofaucet:{{ .Env.TAG_VERSION }}-arm64v8" + build_flag_templates: + - "--target=gnofaucet" + - "--platform=linux/arm64/v8" + - "--label=org.opencontainers.image.created={{.Date}}" + - "--label=org.opencontainers.image.title={{.ProjectName}}/gnofaucet" + - "--label=org.opencontainers.image.revision={{.FullCommit}}" + - "--label=org.opencontainers.image.version={{.Version}}" + ids: + - gnofaucet + - use: buildx + dockerfile: Dockerfile.release + goos: linux + goarch: arm + goarm: 6 + image_templates: + - "ghcr.io/gnolang/{{ .ProjectName }}/gnofaucet:{{ .Version }}-armv6" + - "ghcr.io/gnolang/{{ .ProjectName }}/gnofaucet:{{ .Env.TAG_VERSION }}-armv6" + build_flag_templates: + - "--target=gnofaucet" + - "--platform=linux/arm/v6" + - "--label=org.opencontainers.image.created={{.Date}}" + - "--label=org.opencontainers.image.title={{.ProjectName}}/gnofaucet" + - "--label=org.opencontainers.image.revision={{.FullCommit}}" + - "--label=org.opencontainers.image.version={{.Version}}" + ids: + - gnofaucet + - use: buildx + dockerfile: Dockerfile.release + goos: linux + goarch: arm + goarm: 7 + image_templates: + - "ghcr.io/gnolang/{{ .ProjectName }}/gnofaucet:{{ .Version }}-armv7" + - "ghcr.io/gnolang/{{ .ProjectName }}/gnofaucet:{{ .Env.TAG_VERSION }}-armv7" + build_flag_templates: + - "--target=gnofaucet" + - "--platform=linux/arm/v7" + - "--label=org.opencontainers.image.created={{.Date}}" + - "--label=org.opencontainers.image.title={{.ProjectName}}/gnofaucet" + - "--label=org.opencontainers.image.revision={{.FullCommit}}" + - "--label=org.opencontainers.image.version={{.Version}}" + ids: + - gnofaucet + docker_manifests: # https://goreleaser.com/customization/docker_manifest/ @@ -409,12 +499,12 @@ docker_manifests: - ghcr.io/gnolang/{{ .ProjectName }}:{{ .Version }}-arm64v8 - ghcr.io/gnolang/{{ .ProjectName }}:{{ .Version }}-armv6 - ghcr.io/gnolang/{{ .ProjectName }}:{{ .Version }}-armv7 - - name_template: ghcr.io/gnolang/{{ .ProjectName }}:latest + - name_template: ghcr.io/gnolang/{{ .ProjectName }}:{{ .Env.TAG_VERSION }} image_templates: - - ghcr.io/gnolang/{{ .ProjectName }}:latest-amd64 - - ghcr.io/gnolang/{{ .ProjectName }}:latest-arm64v8 - - ghcr.io/gnolang/{{ .ProjectName }}:latest-armv6 - - ghcr.io/gnolang/{{ .ProjectName }}:latest-armv7 + - ghcr.io/gnolang/{{ .ProjectName }}:{{ .Env.TAG_VERSION }}-amd64 + - ghcr.io/gnolang/{{ .ProjectName }}:{{ .Env.TAG_VERSION }}-arm64v8 + - ghcr.io/gnolang/{{ .ProjectName }}:{{ .Env.TAG_VERSION }}-armv6 + - ghcr.io/gnolang/{{ .ProjectName }}:{{ .Env.TAG_VERSION }}-armv7 # gnoland - name_template: ghcr.io/gnolang/{{ .ProjectName }}/gnoland:{{ .Version }} @@ -423,12 +513,12 @@ docker_manifests: - ghcr.io/gnolang/{{ .ProjectName }}/gnoland:{{ .Version }}-arm64v8 - ghcr.io/gnolang/{{ .ProjectName }}/gnoland:{{ .Version }}-armv6 - ghcr.io/gnolang/{{ .ProjectName }}/gnoland:{{ .Version }}-armv7 - - name_template: ghcr.io/gnolang/{{ .ProjectName }}/gnoland:latest + - name_template: ghcr.io/gnolang/{{ .ProjectName }}/gnoland:{{ .Env.TAG_VERSION }} image_templates: - - ghcr.io/gnolang/{{ .ProjectName }}/gnoland:latest-amd64 - - ghcr.io/gnolang/{{ .ProjectName }}/gnoland:latest-arm64v8 - - ghcr.io/gnolang/{{ .ProjectName }}/gnoland:latest-armv6 - - ghcr.io/gnolang/{{ .ProjectName }}/gnoland:latest-armv7 + - ghcr.io/gnolang/{{ .ProjectName }}/gnoland:{{ .Env.TAG_VERSION }}-amd64 + - ghcr.io/gnolang/{{ .ProjectName }}/gnoland:{{ .Env.TAG_VERSION }}-arm64v8 + - ghcr.io/gnolang/{{ .ProjectName }}/gnoland:{{ .Env.TAG_VERSION }}-armv6 + - ghcr.io/gnolang/{{ .ProjectName }}/gnoland:{{ .Env.TAG_VERSION }}-armv7 # gnokey - name_template: ghcr.io/gnolang/{{ .ProjectName }}/gnokey:{{ .Version }} @@ -437,13 +527,13 @@ docker_manifests: - ghcr.io/gnolang/{{ .ProjectName }}/gnokey:{{ .Version }}-arm64v8 - ghcr.io/gnolang/{{ .ProjectName }}/gnokey:{{ .Version }}-armv6 - ghcr.io/gnolang/{{ .ProjectName }}/gnokey:{{ .Version }}-armv7 - - name_template: ghcr.io/gnolang/{{ .ProjectName }}/gnokey:latest + - name_template: ghcr.io/gnolang/{{ .ProjectName }}/gnokey:{{ .Env.TAG_VERSION }} image_templates: - - ghcr.io/gnolang/{{ .ProjectName }}/gnokey:latest-amd64 - - ghcr.io/gnolang/{{ .ProjectName }}/gnokey:latest-arm64v8 - - ghcr.io/gnolang/{{ .ProjectName }}/gnokey:latest-armv6 - - ghcr.io/gnolang/{{ .ProjectName }}/gnokey:latest-armv7 - + - ghcr.io/gnolang/{{ .ProjectName }}/gnokey:{{ .Env.TAG_VERSION }}-amd64 + - ghcr.io/gnolang/{{ .ProjectName }}/gnokey:{{ .Env.TAG_VERSION }}-arm64v8 + - ghcr.io/gnolang/{{ .ProjectName }}/gnokey:{{ .Env.TAG_VERSION }}-armv6 + - ghcr.io/gnolang/{{ .ProjectName }}/gnokey:{{ .Env.TAG_VERSION }}-armv7 + # gnoweb - name_template: ghcr.io/gnolang/{{ .ProjectName }}/gnoweb:{{ .Version }} image_templates: @@ -451,12 +541,26 @@ docker_manifests: - ghcr.io/gnolang/{{ .ProjectName }}/gnoweb:{{ .Version }}-arm64v8 - ghcr.io/gnolang/{{ .ProjectName }}/gnoweb:{{ .Version }}-armv6 - ghcr.io/gnolang/{{ .ProjectName }}/gnoweb:{{ .Version }}-armv7 - - name_template: ghcr.io/gnolang/{{ .ProjectName }}/gnoweb:latest + - name_template: ghcr.io/gnolang/{{ .ProjectName }}/gnoweb:{{ .Env.TAG_VERSION }} image_templates: - - ghcr.io/gnolang/{{ .ProjectName }}/gnoweb:latest-amd64 - - ghcr.io/gnolang/{{ .ProjectName }}/gnoweb:latest-arm64v8 - - ghcr.io/gnolang/{{ .ProjectName }}/gnoweb:latest-armv6 - - ghcr.io/gnolang/{{ .ProjectName }}/gnoweb:latest-armv7 + - ghcr.io/gnolang/{{ .ProjectName }}/gnoweb:{{ .Env.TAG_VERSION }}-amd64 + - ghcr.io/gnolang/{{ .ProjectName }}/gnoweb:{{ .Env.TAG_VERSION }}-arm64v8 + - ghcr.io/gnolang/{{ .ProjectName }}/gnoweb:{{ .Env.TAG_VERSION }}-armv6 + - ghcr.io/gnolang/{{ .ProjectName }}/gnoweb:{{ .Env.TAG_VERSION }}-armv7 + + # gnofaucet + - name_template: ghcr.io/gnolang/{{ .ProjectName }}/gnofaucet:{{ .Version }} + image_templates: + - ghcr.io/gnolang/{{ .ProjectName }}/gnofaucet:{{ .Version }}-amd64 + - ghcr.io/gnolang/{{ .ProjectName }}/gnofaucet:{{ .Version }}-arm64v8 + - ghcr.io/gnolang/{{ .ProjectName }}/gnofaucet:{{ .Version }}-armv6 + - ghcr.io/gnolang/{{ .ProjectName }}/gnofaucet:{{ .Version }}-armv7 + - name_template: ghcr.io/gnolang/{{ .ProjectName }}/gnofaucet:{{ .Env.TAG_VERSION }} + image_templates: + - ghcr.io/gnolang/{{ .ProjectName }}/gnofaucet:{{ .Env.TAG_VERSION }}-amd64 + - ghcr.io/gnolang/{{ .ProjectName }}/gnofaucet:{{ .Env.TAG_VERSION }}-arm64v8 + - ghcr.io/gnolang/{{ .ProjectName }}/gnofaucet:{{ .Env.TAG_VERSION }}-armv6 + - ghcr.io/gnolang/{{ .ProjectName }}/gnofaucet:{{ .Env.TAG_VERSION }}-armv7 docker_signs: - cmd: cosign @@ -493,4 +597,11 @@ release: You can find all docker images at: - https://github.com/orgs/gnolang/packages?repo_name={{ .ProjectName }} \ No newline at end of file + https://github.com/orgs/gnolang/packages?repo_name={{ .ProjectName }} + +# Only valid for nightly build +nightly: + tag_name: nightly + publish_release: true + keep_single_release: true + name_template: "{{ incpatch .Version }}-{{ .ShortCommit }}-{{ .Env.TAG_VERSION }}" diff --git a/.github/workflows/nightlies.yml b/.github/workflows/nightlies.yml index 6e3e3e58935..0110801dc93 100644 --- a/.github/workflows/nightlies.yml +++ b/.github/workflows/nightlies.yml @@ -38,8 +38,9 @@ jobs: - uses: goreleaser/goreleaser-action@v6 with: distribution: goreleaser-pro - version: v1.26.2-pro - args: release --clean --nightly --config ./.github/goreleaser-nightly.yaml + version: ~> v2 + args: release --clean --nightly --config ./.github/goreleaser.yaml env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} + TAG_VERSION: nightly diff --git a/.github/workflows/releaser-master.yml b/.github/workflows/releaser-master.yml index 3ed5353ec89..0517deeff2f 100644 --- a/.github/workflows/releaser-master.yml +++ b/.github/workflows/releaser-master.yml @@ -39,8 +39,9 @@ jobs: - uses: goreleaser/goreleaser-action@v6 with: distribution: goreleaser-pro - version: v1.26.2-pro - args: release --clean --nightly --config ./.github/goreleaser-master.yaml + version: ~> v2 + args: release --clean --skip publish --config ./.github/goreleaser.yaml env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} + TAG_VERSION: master diff --git a/.github/workflows/releaser.yml b/.github/workflows/releaser.yml index 9148d9ac15c..f3317419510 100644 --- a/.github/workflows/releaser.yml +++ b/.github/workflows/releaser.yml @@ -38,7 +38,7 @@ jobs: - uses: goreleaser/goreleaser-action@v6 with: distribution: goreleaser-pro - version: v1.26.2-pro + version: ~> v2 args: release --clean --config ./.github/goreleaser.yaml env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/Dockerfile.release b/Dockerfile.release index 2e36453382e..644f8cb5de9 100644 --- a/Dockerfile.release +++ b/Dockerfile.release @@ -35,6 +35,13 @@ COPY ./gnoweb /usr/bin/gnoweb EXPOSE 8888 ENTRYPOINT [ "/usr/bin/gnoweb" ] +# +## ghcr.io/gnolang/gno/gnofaucet +FROM base as gnofaucet + +COPY ./gnofaucet /usr/bin/gnofaucet +EXPOSE 5050 +ENTRYPOINT [ "/usr/bin/gnofaucet" ] # ## ghcr.io/gnolang/gno