From 2e5884cbbcf8a04d35be8d70e2a52869a7a78d66 Mon Sep 17 00:00:00 2001 From: dosco <832235+dosco@users.noreply.github.com> Date: Fri, 6 Sep 2024 01:47:45 -0700 Subject: [PATCH] Release v3.0.36 --- auth/go.mod | 2 +- cmd/go.mod | 8 ++--- conf/go.mod | 2 +- go.work.sum | 1 + plugin/otel/go.mod | 2 +- release.go | 89 ++++++++++++++++++++++++++++++++++++++++++++++ release.sh | 24 ++++++------- serv/go.mod | 6 ++-- tests/go.mod | 4 +-- wasm/go.mod | 4 +-- 10 files changed, 116 insertions(+), 26 deletions(-) create mode 100644 release.go diff --git a/auth/go.mod b/auth/go.mod index 1c01a21b..95c5a6ff 100644 --- a/auth/go.mod +++ b/auth/go.mod @@ -5,7 +5,7 @@ go 1.18 require ( github.com/adjust/gorails v0.0.0-20171013043634-2786ed0c03d3 github.com/bradfitz/gomemcache v0.0.0-20230905024940-24af94b03874 - github.com/dosco/graphjin/core/v3 v + github.com/dosco/graphjin/core/v3 v3.0.36 github.com/golang-jwt/jwt v3.2.2+incompatible github.com/gomodule/redigo v1.9.2 github.com/gorilla/websocket v1.5.3 diff --git a/cmd/go.mod b/cmd/go.mod index e3a423bb..93fe0206 100644 --- a/cmd/go.mod +++ b/cmd/go.mod @@ -7,8 +7,8 @@ toolchain go1.23.1 require ( github.com/brianvoe/gofakeit/v6 v6.28.0 github.com/dop251/goja v0.0.0-20240828124009-016eb7256539 - github.com/dosco/graphjin/core/v3 v - github.com/dosco/graphjin/serv/v3 v + github.com/dosco/graphjin/core/v3 v3.0.36 + github.com/dosco/graphjin/serv/v3 v3.0.36 github.com/gosimple/slug v1.14.0 github.com/jackc/pgx/v5 v5.6.0 github.com/jvatic/goja-babel v0.0.0-20240829121804-52a2d5a94eb5 @@ -45,8 +45,8 @@ require ( github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect github.com/dimchansky/utfbom v1.1.1 // indirect github.com/dlclark/regexp2 v1.11.4 // indirect - github.com/dosco/graphjin/auth/v3 v // indirect - github.com/dosco/graphjin/plugin/otel/v3 v // indirect + github.com/dosco/graphjin/auth/v3 v3.0.36 // indirect + github.com/dosco/graphjin/plugin/otel/v3 v3.0.36 // indirect github.com/fatih/color v1.16.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect diff --git a/conf/go.mod b/conf/go.mod index ce11a159..22add0b2 100644 --- a/conf/go.mod +++ b/conf/go.mod @@ -3,7 +3,7 @@ module github.com/dosco/graphjin/conf/v3 go 1.18 require ( - github.com/dosco/graphjin/core/v3 v + github.com/dosco/graphjin/core/v3 v3.0.36 gopkg.in/yaml.v3 v3.0.1 ) diff --git a/go.work.sum b/go.work.sum index 267fa12f..c319c0ff 100644 --- a/go.work.sum +++ b/go.work.sum @@ -29,6 +29,7 @@ github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxG github.com/deepmap/oapi-codegen v1.10.1/go.mod h1:TvVmDQlUkFli9gFij/gtW1o+tFBr4qCHyv2zG+R0YZY= github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/dop251/goja_nodejs v0.0.0-20211022123610-8dd9abb0616d/go.mod h1:DngW8aVqWbuLRMHItjPUyqdj+HWPvnQe8V8y1nDpIbM= +github.com/dosco/graphjin/core/v3 v3.0.35/go.mod h1:jnqpOc5MuXa1jqaok8Drlh0BAPw12IwOECspmouoABc= github.com/elastic/elastic-transport-go/v8 v8.2.0/go.mod h1:87Tcz8IVNe6rVSLdBux1o/PEItLtyabHU3naC7IoqKI= github.com/elastic/go-elasticsearch/v7 v7.17.10/go.mod h1:OJ4wdbtDNk5g503kvlHLyErCgQwwzmDtaFC4XyOxXA4= github.com/elastic/go-elasticsearch/v8 v8.9.0/go.mod h1:NGmpvohKiRHXI0Sw4fuUGn6hYOmAXlyCphKpzVBiqDE= diff --git a/plugin/otel/go.mod b/plugin/otel/go.mod index bd9988f0..3985d412 100644 --- a/plugin/otel/go.mod +++ b/plugin/otel/go.mod @@ -5,7 +5,7 @@ go 1.21 toolchain go1.23.1 require ( - github.com/dosco/graphjin/core/v3 v + github.com/dosco/graphjin/core/v3 v3.0.36 go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.42.0 go.opentelemetry.io/otel v1.29.0 go.opentelemetry.io/otel/trace v1.29.0 diff --git a/release.go b/release.go new file mode 100644 index 00000000..3e9383bb --- /dev/null +++ b/release.go @@ -0,0 +1,89 @@ +package main + +import ( + "fmt" + "os" + "os/exec" + "path/filepath" + "regexp" +) + +func main() { + if len(os.Args) != 2 { + fmt.Println("Usage: go run script.go ") + os.Exit(1) + } + + newVersion := os.Args[1] + versionRegex := regexp.MustCompile(`(github.com\/dosco\/graphjin\/[^\s]+) v[0-9]+\.[0-9]+\.[0-9]+`) + replaceFormat := "$1 v" + newVersion + + err := filepath.Walk(".", func(path string, info os.FileInfo, err error) error { + if err != nil { + return err + } + if !info.IsDir() && filepath.Base(path) == "go.mod" { + fmt.Println("Processing:", path) + updateFile(path, versionRegex, replaceFormat) + } + return nil + }) + if err != nil { + fmt.Println("Error walking through files:", err) + return + } + + if err = gitCommands(newVersion); err != nil { + fmt.Println("Error executing git commands:", err) + } +} + +func updateFile(filePath string, versionRegex *regexp.Regexp, replaceFormat string) { + input, err := os.ReadFile(filePath) + if err != nil { + fmt.Println("Failed to read file:", err) + return + } + + content := string(input) + updatedContent := versionRegex.ReplaceAllString(content, replaceFormat) + + if updatedContent != content { + err = os.WriteFile(filePath, []byte(updatedContent), 0644) + if err != nil { + fmt.Println("Failed to write updated content to file:", err) + } + } +} + +func gitCommands(version string) error { + steps := []struct { + command string + args []string + }{ + {"git", []string{"add", "."}}, + {"git", []string{"commit", "-m", fmt.Sprintf("Release v%s", version)}}, + {"git", []string{"tag", fmt.Sprintf("auth/v%s", version)}}, + {"git", []string{"tag", fmt.Sprintf("cmd/v%s", version)}}, + {"git", []string{"tag", fmt.Sprintf("conf/v%s", version)}}, + {"git", []string{"tag", fmt.Sprintf("core/v%s", version)}}, + {"git", []string{"tag", fmt.Sprintf("plugin/otel/v%s", version)}}, + {"git", []string{"tag", fmt.Sprintf("serv/v%s", version)}}, + {"git", []string{"tag", fmt.Sprintf("tests/v%s", version)}}, + {"git", []string{"tag", fmt.Sprintf("wasm/v%s", version)}}, + {"git", []string{"tag", fmt.Sprintf("v%s", version)}}, + {"git", []string{"push", "origin", "master"}}, + {"git", []string{"push", "--tags"}}, + } + + for _, step := range steps { + cmd := exec.Command(step.command, step.args...) + cmd.Stderr = os.Stderr + cmd.Stdout = os.Stdout + if err := cmd.Run(); err != nil { + return fmt.Errorf("%s %v failed: %w", step.command, step.args, err) + } + } + + return nil +} diff --git a/release.sh b/release.sh index 6441f681..66b78a13 100755 --- a/release.sh +++ b/release.sh @@ -18,17 +18,17 @@ find . -name 'go.mod' -exec sh -c ' done ' sh {} + -git add . -git commit -m "Release v$new_version" +# git add . +# git commit -m "Release v$new_version" -git tag auth/v$1 -git tag cmd/v$1 -git tag conf/v$1 -git tag core/v$1 -git tag plugin/otel/v$1 -git tag serv/v$1 -git tag tests/v$1 -git tag wasm/v$1 +# git tag auth/v$1 +# git tag cmd/v$1 +# git tag conf/v$1 +# git tag core/v$1 +# git tag plugin/otel/v$1 +# git tag serv/v$1 +# git tag tests/v$1 +# git tag wasm/v$1 -git tag v$1 -git push --tags +# git tag v$1 +# git push --tags diff --git a/serv/go.mod b/serv/go.mod index 748ab7fa..babec07c 100644 --- a/serv/go.mod +++ b/serv/go.mod @@ -5,9 +5,9 @@ go 1.21 toolchain go1.23.1 require ( - github.com/dosco/graphjin/auth/v3 v - github.com/dosco/graphjin/core/v3 v - github.com/dosco/graphjin/plugin/otel/v3 v + github.com/dosco/graphjin/auth/v3 v3.0.36 + github.com/dosco/graphjin/core/v3 v3.0.36 + github.com/dosco/graphjin/plugin/otel/v3 v3.0.36 github.com/fsnotify/fsnotify v1.7.0 github.com/go-http-utils/headers v0.0.0-20181008091004-fed159eddc2a github.com/go-pkgz/expirable-cache v1.0.0 diff --git a/tests/go.mod b/tests/go.mod index c3f4f354..e80106fc 100644 --- a/tests/go.mod +++ b/tests/go.mod @@ -5,8 +5,8 @@ go 1.21 toolchain go1.23.1 require ( - github.com/dosco/graphjin/conf/v3 v - github.com/dosco/graphjin/core/v3 v + github.com/dosco/graphjin/conf/v3 v3.0.36 + github.com/dosco/graphjin/core/v3 v3.0.36 github.com/orlangure/gnomock v0.30.0 github.com/stretchr/testify v1.9.0 golang.org/x/sync v0.8.0 diff --git a/wasm/go.mod b/wasm/go.mod index a3603f9a..64118ba7 100644 --- a/wasm/go.mod +++ b/wasm/go.mod @@ -3,8 +3,8 @@ module github.com/dosco/graphjin/wasm/v3 go 1.18 require ( - github.com/dosco/graphjin/conf/v3 v - github.com/dosco/graphjin/core/v3 v + github.com/dosco/graphjin/conf/v3 v3.0.36 + github.com/dosco/graphjin/core/v3 v3.0.36 ) require (