From b7ece0dee6038fd3d02de0541167bfdd3dcce556 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lovro=20Ma=C5=BEgon?= Date: Tue, 20 Sep 2022 20:21:48 +0200 Subject: [PATCH 1/4] add goreleaser --- .github/workflows/release.yml | 33 ++++++++++++++++++++++++++++ .goreleaser.yml | 29 ++++++++++++++++++++++++ Makefile | 2 +- cmd/{generator => connector}/main.go | 0 spec.go | 7 +++++- 5 files changed, 69 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/release.yml create mode 100644 .goreleaser.yml rename cmd/{generator => connector}/main.go (100%) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..2d89667 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,33 @@ +name: release + +on: + push: + tags: + - v* + +permissions: + contents: write + +jobs: + release: + name: Release + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: 1.18 + + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v3 + with: + distribution: goreleaser + version: latest + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..03972ec --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,29 @@ +builds: + - main: ./cmd/connector/main.go + goos: + - darwin + - linux + - windows + env: + - CGO_ENABLED=0 + ldflags: + - "-s -w -X 'github.com/conduitio-labs/conduit-connector-generator.version={{ .Tag }}'" +checksum: + name_template: checksums.txt +archives: + - replacements: + darwin: Darwin + linux: Linux + windows: Windows + 386: i386 + amd64: x86_64 +changelog: + sort: asc + use: github + filters: + exclude: + - '^docs:' + - '^test:' + - '^go.mod:' + - '^.github:' + - Merge branch diff --git a/Makefile b/Makefile index 7e6f5f5..024ac84 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ .PHONY: build test build: - go build -o conduit-connector-generator cmd/generator/main.go + go build -ldflags "-X 'github.com/conduitio-labs/conduit-connector-generator.version=${VERSION}'" -o conduit-connector-algolia cmd/connector/main.go test: go test $(GOTEST_FLAGS) -race ./... diff --git a/cmd/generator/main.go b/cmd/connector/main.go similarity index 100% rename from cmd/generator/main.go rename to cmd/connector/main.go diff --git a/spec.go b/spec.go index 2adfc23..f7b3796 100644 --- a/spec.go +++ b/spec.go @@ -18,13 +18,18 @@ import ( sdk "github.com/conduitio/conduit-connector-sdk" ) +// version is set during the build process (i.e. the Makefile). +// It follows Go's convention for module version, where the version +// starts with the letter v, followed by a semantic version. +var version = "dev" + // Specification returns the Plugin's Specification. func Specification() sdk.Specification { return sdk.Specification{ Name: "generator", Summary: "Generator plugin", Description: "A plugin capable of generating dummy records (in JSON format).", - Version: "v0.1.0", + Version: version, Author: "Meroxa, Inc.", } } From fafe1ae74876baa088e39a5c377958dc5ea8ff95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lovro=20Ma=C5=BEgon?= Date: Wed, 21 Sep 2022 13:45:01 +0200 Subject: [PATCH 2/4] fixes --- .goreleaser.yml | 2 +- Makefile | 2 +- spec.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 03972ec..3600ac7 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -7,7 +7,7 @@ builds: env: - CGO_ENABLED=0 ldflags: - - "-s -w -X 'github.com/conduitio-labs/conduit-connector-generator.version={{ .Tag }}'" + - "-s -w -X 'github.com/conduitio/conduit-connector-generator.version={{ .Tag }}'" checksum: name_template: checksums.txt archives: diff --git a/Makefile b/Makefile index 024ac84..6d990c9 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ .PHONY: build test build: - go build -ldflags "-X 'github.com/conduitio-labs/conduit-connector-generator.version=${VERSION}'" -o conduit-connector-algolia cmd/connector/main.go + go build -ldflags "-X 'github.com/conduitio/conduit-connector-generator.version=${VERSION}'" -o conduit-connector-generator cmd/connector/main.go test: go test $(GOTEST_FLAGS) -race ./... diff --git a/spec.go b/spec.go index f7b3796..174d8db 100644 --- a/spec.go +++ b/spec.go @@ -21,7 +21,7 @@ import ( // version is set during the build process (i.e. the Makefile). // It follows Go's convention for module version, where the version // starts with the letter v, followed by a semantic version. -var version = "dev" +var version = "v0.0.0-dev" // Specification returns the Plugin's Specification. func Specification() sdk.Specification { From a1fffc284073e4147de2e564b8c70870c795fb0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lovro=20Ma=C5=BEgon?= Date: Wed, 21 Sep 2022 14:09:19 +0200 Subject: [PATCH 3/4] makefile version --- Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile b/Makefile index 6d990c9..ef0a3cc 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,7 @@ .PHONY: build test +VERSION=`git describe --tags --dirty --always` + build: go build -ldflags "-X 'github.com/conduitio/conduit-connector-generator.version=${VERSION}'" -o conduit-connector-generator cmd/connector/main.go From 00ba2665a63664ce989b6fed7f53bd14ccac99ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lovro=20Ma=C5=BEgon?= Date: Wed, 21 Sep 2022 14:15:34 +0200 Subject: [PATCH 4/4] makefile version --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index ef0a3cc..10c78c0 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ .PHONY: build test -VERSION=`git describe --tags --dirty --always` +VERSION=$(shell git describe --tags --dirty --always) build: go build -ldflags "-X 'github.com/conduitio/conduit-connector-generator.version=${VERSION}'" -o conduit-connector-generator cmd/connector/main.go