From 4938ea43fdb96c206c9f1df9024ebe408e4f6c3d Mon Sep 17 00:00:00 2001 From: Adam Lehechka <42357034+alehechka@users.noreply.github.com> Date: Sat, 30 Jul 2022 22:49:07 -0500 Subject: [PATCH] Resolve issues with goreleaser action [v0.2.3] (#11) * resolve gorelease build * quote 'tag' in release.yaml * add ldflags to goreleaser config * move template to own package to fix builds * add CHANGELOG entry for v0.2.3 release * GHA release only on tags --- .github/workflows/release.yaml | 1 + .goreleaser.yaml | 21 +++++++++++++++++++ CHANGELOG.md | 4 ++++ protoc-gen-graphql/main.go | 3 ++- protoc-gen-graphql/{ => template}/template.go | 4 ++-- 5 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 .goreleaser.yaml rename protoc-gen-graphql/{ => template}/template.go (99%) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 47875ed..3f13f03 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -31,6 +31,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} push_bsr_plugins: + if: github.ref_type == 'tag' runs-on: ubuntu-latest steps: diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..1fd9590 --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,21 @@ +builds: + - main: ./protoc-gen-graphql/main.go + id: protoc-gen-graphql + binary: protoc-gen-graphql + env: + - CGO_ENABLED=0 + goos: + - linux + - darwin + - windows + goarch: + - amd64 + - arm64 + ldflags: + - -s -w -X main.version={{.Version}} +archives: + - name_template: '{{ .Binary }}-{{ .Tag }}-{{ .Os }}-{{ .Arch }}' + format: binary + replacements: + amd64: x86_64 +dist: _output diff --git a/CHANGELOG.md b/CHANGELOG.md index b4639a3..1a20822 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # CHANGELOG +## [v0.2.3](https://github.com/alehechka/grpc-graphql-gateway/releases/tag/v0.2.3) + +- Resolve issues with goreleaser action [v0.2.3] ([#11](https://github.com/alehechka/grpc-graphql-gateway/pull/11)) + ## [v0.2.2](https://github.com/alehechka/grpc-graphql-gateway/releases/tag/v0.2.2) - GitHub Action Workflows - Pull Request Verification ([#7](https://github.com/alehechka/grpc-graphql-gateway/pull/7)) diff --git a/protoc-gen-graphql/main.go b/protoc-gen-graphql/main.go index aceb0a9..29b3668 100644 --- a/protoc-gen-graphql/main.go +++ b/protoc-gen-graphql/main.go @@ -10,6 +10,7 @@ import ( // nolint: staticcheck "github.com/alehechka/grpc-graphql-gateway/protoc-gen-graphql/generator" "github.com/alehechka/grpc-graphql-gateway/protoc-gen-graphql/spec" + "github.com/alehechka/grpc-graphql-gateway/protoc-gen-graphql/template" "github.com/golang/protobuf/proto" plugin "github.com/golang/protobuf/protoc-gen-go/plugin" ) @@ -82,7 +83,7 @@ func main() { } } if len(ftg) > 0 { - genFiles, err := g.Generate(goTemplate, ftg) + genFiles, err := g.Generate(template.GoTemplate, ftg) if err != nil { genError = err return diff --git a/protoc-gen-graphql/template.go b/protoc-gen-graphql/template/template.go similarity index 99% rename from protoc-gen-graphql/template.go rename to protoc-gen-graphql/template/template.go index cebe057..4a101e6 100644 --- a/protoc-gen-graphql/template.go +++ b/protoc-gen-graphql/template/template.go @@ -1,6 +1,6 @@ -package main +package template -var goTemplate = ` +var GoTemplate = ` // Code generated by proroc-gen-graphql, DO NOT EDIT. package {{ .RootPackage.Name }}