diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 73b3dd3b..30dc6b3d 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -59,16 +59,22 @@ jobs: - name: "Git Version" id: generate-version uses: codacy/git-version@2.8.0 + with: + release-branch: main + prefix: v - name: "Tag version" run: | git tag ${{ steps.generate-version.outputs.version }} git push --tags "https://codacy:${{ secrets.GITHUB_TOKEN }}@github.com/codacy/codacy-cli-v2" + - name: Get Go version + id: go-version + run: echo "VERSION=$(go version | cut -d' ' -f3)" >> $GITHUB_OUTPUT - name: Run GoReleaser uses: goreleaser/goreleaser-action@v5 with: distribution: goreleaser - # 'latest', 'nightly', or a semver - version: "latest" + version: "~> v1" args: release --clean env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GOVERSION: ${{ steps.go-version.outputs.VERSION }} diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 00000000..fcebc950 --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,51 @@ +project_name: codacy-cli-v2 + +before: + hooks: + - go mod tidy + +builds: + - env: + - CGO_ENABLED=0 + goos: + - linux + - windows + - darwin + goarch: + - amd64 + - arm64 + ldflags: + - -s -w + - -X codacy/cli-v2/version.Version={{.Version}} + - -X codacy/cli-v2/version.GitCommit={{.ShortCommit}} + - -X codacy/cli-v2/version.BuildTime={{.Date}} + - -X codacy/cli-v2/version.Os={{.Os}} + - -X codacy/cli-v2/version.Arch={{.Arch}} + - -X codacy/cli-v2/version.GoVersion={{.Env.GOVERSION}} + binary: cli-v2 + +archives: + - format: tar.gz + name_template: >- + {{ .ProjectName }}_ + {{- .Version }}_ + {{- .Os }}_ + {{- .Arch }} + format_overrides: + - goos: windows + format: zip + +changelog: + sort: asc + filters: + exclude: + - '^docs:' + - '^test:' + - '^ci:' + - Merge pull request + - Merge branch + +release: + github: + owner: codacy + name: codacy-cli-v2 \ No newline at end of file