From dc92db5eb960b4514a7980cc4a37bdf2d0bf2ffb Mon Sep 17 00:00:00 2001 From: kayrus <kay.diam@gmail.com> Date: Tue, 16 Jul 2024 16:04:33 +0200 Subject: [PATCH] Introduce goreleaser --- .github/workflows/release.yml | 34 +++++++++++++++++++++++++++ .goreleaser.yml | 43 +++++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+) create mode 100644 .github/workflows/release.yml create mode 100644 .goreleaser.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..33096d7 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,34 @@ +# This GitHub action will publish assets for release when a tag is created +# that matches the pattern "v*" (ie. v0.1.0). +# +# Based on the configuration provided at: +# https://github.com/hashicorp/terraform-provider-scaffolding +name: Release + +on: + push: + tags: + - 'v*' + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Unshallow + run: git fetch --prune --unshallow + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.22' + + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v6 + with: + version: v2 + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..ffc48f2 --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,43 @@ +# Visit https://goreleaser.com for documentation on how to customize this +# behavior. +version: 2 +before: + hooks: + # this is just an example and not a requirement for provider building/publishing + - go mod tidy +builds: + - env: + # goreleaser does not work with CGO, it could also complicate + # usage by users in CI/CD systems like Terraform Cloud where + # they are unable to install libraries. + - CGO_ENABLED=0 + mod_timestamp: '{{ .CommitTimestamp }}' + flags: + - -trimpath + ldflags: + - '-s -w -X main.Version={{.Version}}' + goos: + - freebsd + - windows + - linux + - darwin + goarch: + - amd64 + - '386' + - arm + - arm64 + ignore: + - goos: darwin + goarch: '386' + binary: '{{ .ProjectName }}' +archives: + - format: zip + name_template: '{{ .ProjectName }}-{{ .Version }}-{{ .Os }}-{{ .Arch }}' +checksum: + name_template: '{{ .ProjectName }}-{{ .Version }}-SHA256SUMS' + algorithm: sha256 +release: + # Visit your project's GitHub Releases page to publish this release. + draft: true +changelog: + disable: true -- GitLab