Skip to content

Commit

Permalink
Introduce goreleaser
Browse files Browse the repository at this point in the history
  • Loading branch information
kayrus committed Jul 16, 2024
1 parent d414347 commit dc92db5
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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 }}
43 changes: 43 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit dc92db5

Please sign in to comment.