From 739591c76c8a282813038c9106eaeb962fdd2941 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lovro=20Ma=C5=BEgon?= Date: Thu, 22 Sep 2022 13:35:55 +0200 Subject: [PATCH] add goreleaser (#25) --- .github/workflows/release.yml | 33 +++++++++++++++++++ .goreleaser.yml | 29 ++++++++++++++++ Makefile | 4 ++- cmd/{sf => connector}/acceptance_test.go | 0 cmd/{sf => connector}/main.go | 0 .../oauth_client_mock_test.go | 0 .../streaming_client_mock_test.go | 0 spec.go | 7 +++- 8 files changed, 71 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/release.yml create mode 100644 .goreleaser.yml rename cmd/{sf => connector}/acceptance_test.go (100%) rename cmd/{sf => connector}/main.go (100%) rename cmd/{sf => connector}/oauth_client_mock_test.go (100%) rename cmd/{sf => connector}/streaming_client_mock_test.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..7ef8ec3 --- /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-salesforce.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 f0ac70d..35156c9 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,9 @@ .PHONY: build test lint +VERSION=$(shell git describe --tags --dirty --always) + build: - go build -o conduit-connector-salesforce cmd/sf/main.go + go build -ldflags "-X 'github.com/conduitio-labs/conduit-connector-salesforce.version=${VERSION}'" -o conduit-connector-salesforce cmd/connector/main.go test: go test $(GOTEST_FLAGS) -race ./... diff --git a/cmd/sf/acceptance_test.go b/cmd/connector/acceptance_test.go similarity index 100% rename from cmd/sf/acceptance_test.go rename to cmd/connector/acceptance_test.go diff --git a/cmd/sf/main.go b/cmd/connector/main.go similarity index 100% rename from cmd/sf/main.go rename to cmd/connector/main.go diff --git a/cmd/sf/oauth_client_mock_test.go b/cmd/connector/oauth_client_mock_test.go similarity index 100% rename from cmd/sf/oauth_client_mock_test.go rename to cmd/connector/oauth_client_mock_test.go diff --git a/cmd/sf/streaming_client_mock_test.go b/cmd/connector/streaming_client_mock_test.go similarity index 100% rename from cmd/sf/streaming_client_mock_test.go rename to cmd/connector/streaming_client_mock_test.go diff --git a/spec.go b/spec.go index f4ffed9..b16c4c5 100644 --- a/spec.go +++ b/spec.go @@ -19,12 +19,17 @@ import ( "github.com/miquido/conduit-connector-salesforce/source" ) +// 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 = "v0.0.0-dev" + func Specification() sdk.Specification { return sdk.Specification{ Name: "salesforce", Summary: "A Salesforce source plugin for Conduit.", Description: "The Conduit plugin supporting Salesforce source.", - Version: "v0.1.0", + Version: version, Author: "Miquido", DestinationParams: map[string]sdk.Parameter{ //