Skip to content

Commit

Permalink
ci: Update the GoReleaser configuration.
Browse files Browse the repository at this point in the history
  • Loading branch information
skyzyx committed Nov 20, 2023
1 parent e0b5924 commit a1dd8ef
Showing 1 changed file with 89 additions and 218 deletions.
307 changes: 89 additions & 218 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,247 +1,118 @@
---
# Pro License
variables:
SourceOrg: ''
SourceRepo: terraform-provider-corefunc
Description: Utilities that should have been Terraform_core functions.
MaintainerName: Northwood Labs
MaintainerEmail: ''
AppleCertificateID: ''
GPGKeyID: ''

project_name: terraform-provider-corefunc
dist: ./dist

changelog:
skip: false
# https://goreleaser.com/customization/reportsizes/
report_sizes: true

archives:
- id: linux-archive
builds:
- linux
allow_different_binary_count: false
wrap_in_directory: false
format: zip
files:
- none*
name_template: '{{ .ProjectName }}_v{{ .Version }}_{{ .Os }}_{{ .Arch }}'

- id: windows-archive
builds:
- windows
allow_different_binary_count: false
wrap_in_directory: false
format: zip
files:
- none*
name_template: '{{ .ProjectName }}_v{{ .Version }}_{{ .Os }}_{{ .Arch }}'

- id: macos-archive
builds:
- macos-universal
allow_different_binary_count: false
wrap_in_directory: false
format: zip
files:
- none*
name_template: '{{ .ProjectName }}_v{{ .Version }}_{{ .Os }}_universal'
before:
hooks:
- make tidy

# https://goreleaser.com/customization/builds/
builds:
#-----------------------------------------------------------------------------
# Linux

- id: linux
dir: .
main: .
binary: '{{ .ProjectName }}_v{{ .Version }}'
skip: false
ldflags:
- -s -w
- -X main.commit={{.Commit}}
- -X main.date={{.Date}}
- -X main.version={{.Version}}
env:
- env:
- CGO_ENABLED=0
goos:
- linux
goarch:
- amd64
- arm64
# GOAMD64 to build when GOARCH is amd64. https://en.wikipedia.org/wiki/X86-64#Microarchitecture_levels
# goamd64:
# - v1 # (general purpose)
# - v2 # (c. 2009, QEMU)
# - v3 # (c. 2015)
# - v4 # (c. 2021)
hooks:
pre:
- make build-release-prep
post:
# any binary signatures that should happen

#-----------------------------------------------------------------------------
# Windows

- id: windows
dir: .
main: .
binary: '{{ .ProjectName }}_v{{ .Version }}'
skip: false
mod_timestamp: '{{ .CommitTimestamp }}'
flags:
- -trimpath
ldflags:
- -s -w
- -X main.commit={{.Commit}}
- -X main.date={{.Date}}
- -X main.version={{.Version}}
env:
- CGO_ENABLED=0
- -s -w -X github.com/northwood-labs/terraform-provider-corefunc/cmd.Version={{.Version}}
goos:
- freebsd
- openbsd
- solaris
- windows
goarch:
- amd64
- arm64
# GOAMD64 to build when GOARCH is amd64. https://en.wikipedia.org/wiki/X86-64#Microarchitecture_levels
# goamd64:
# - v1 # (general purpose)
# - v2 # (c. 2009, QEMU)
# - v3 # (c. 2015)
# - v4 # (c. 2021)
hooks:
pre:
- make build-release-prep
post:
# any binary signatures that should happen

#-----------------------------------------------------------------------------
# macOS

- id: macos
dir: .
main: .
binary: '{{ .ProjectName }}_v{{ .Version }}'
skip: false
ldflags:
- -s -w
- -X main.commit={{.Commit}}
- -X main.date={{.Date}}
- -X main.version={{.Version}}
env:
- CGO_ENABLED=0
goos:
- linux
- darwin
goarch:
- amd64
- '386'
- arm
- arm64
# GOAMD64 to build when GOARCH is amd64. https://en.wikipedia.org/wiki/X86-64#Microarchitecture_levels
# goamd64:
# - v1 # (general purpose)
# - v2 # (c. 2009, QEMU)
# - v3 # (c. 2015)
# - v4 # (c. 2021)
hooks:
pre:
- make build-release-prep
ignore:
- goos: darwin
goarch: '386'
- goos: openbsd
goarch: arm
- goos: openbsd
goarch: arm64
binary: '{{ .ProjectName }}_v{{ .Version }}'

universal_binaries:
- id: macos-universal
ids:
- macos
name_template: '{{ .ProjectName }}_v{{ .Version }}'
replace: true
hooks:
post:
# Apple Account
# https://developer.apple.com/account/resources/certificates/
- codesign -s {{.Var.AppleCertificateID}} -o runtime -v './dist/macos-universal_darwin_all/{{.ProjectName}}_v{{ .Version
}}'
# https://goreleaser.com/customization/archive/
archives:
- format: zip
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}'

# https://goreleaser.com/customization/checksum/
checksum:
name_template: '{{ .ProjectName }}-checksums.txt'
name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS'
algorithm: sha256

# https://goreleaser.com/customization/sign/
signs:
- id: gpg
ids:
- linux-archive
- windows-archive
signature: ${artifact}.sig
cmd: gpg2
args: [-u, '{{ .Var.GPGKeyID }}', --output, '${signature}', --detach-sign, '${artifact}']
artifacts: all

- id: gatekeeper
ids:
- macos-archive
signature: ${artifact}
cmd: xcrun
args: [notarytool, submit, './dist/{{ .ProjectName }}_v{{ .Version }}_darwin_universal.zip', --apple-id, '{{ .Env.AC_APPLE_ID
}}', --password, '{{ .Env.AC_PASSWORD }}', --team-id, '{{ .Env.AC_TEAM_ID }}', --progress, --wait]
artifacts: all

- artifacts: checksum
args:
- --batch
- --local-user
- '{{ .Env.GPG_FINGERPRINT }}' # set this environment variable for your signing key
- --output
- ${signature}
- --detach-sign
- ${artifact}

# https://goreleaser.com/customization/release/
release:
# Repo in which the release will be created.
# Default is extracted from the origin remote URL or empty if its private hosted.
github:
owner: '{{ .Var.SourceOrg }}'
name: '{{ .Var.SourceRepo }}'

# IDs of the archives to use.
# Defaults to all.
# ids:
# - foo
# - bar

# If set to true, will not auto-publish the release.
# Default is false.
# Visit your project's GitHub Releases page to publish this release.
draft: true

# If set to auto, will mark the release as not ready for production
# in case there is an indicator for this in the tag e.g. v1.0.0-rc1
# If set to true, will mark the release as not ready for production.
# Default is false.
prerelease: auto

# What to do with the release notes in case there the release already exists.
#
# Valid options are:
# - `keep-existing`: keep the existing notes
# - `append`: append the current release notes to the existing notes
# - `prepend`: prepend the current release notes to the existing notes
# - `replace`: replace existing notes
#
# Default is `keep-existing`.
mode: replace

# Header template for the release body.
# Defaults to empty.
header: |
## What's Changed
# Footer template for the release body.
# Defaults to empty.
extra_files:
- glob: terraform-registry-manifest.json
name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json'
footer: |
## Verifying Assets
Learn how to verify releases at @TODO.
## Asset Naming
# You can change the name of the release.
# Default is `{{.Tag}}` on OSS and `{{.PrefixedTag}}` on Pro.
# name_template: "{{.ProjectName}}-v{{.Version}} {{.Env.USER}}"
| Synonyms | Description |
|-----------------------|------------------------------|
| `x86_64` and `amd64` | 64-bit Intel and/or AMD CPUs |
| `aarch64` and `arm64` | 64-bit ARM CPUs |
# You can disable this pipe in order to not create the release on any SCM.
# Keep in mind that this might also break things that depend on the release URL, for instance, homebrew taps.
#
# Defaults to false.
# disable: true
name_template: '{{.Version}} — {{time "2006-01-02"}}'

# You can add extra pre-existing files to the release.
# The filename on the release will be the last part of the path (base).
# If another file with the same name exists, the last one found will be used.
# These globs can also include templates.
#
# Defaults to empty.
# extra_files:
# - glob: ./path/to/file.txt
# - glob: ./glob/**/to/**/file/**/*
# - glob: ./glob/foo/to/bar/file/foobar/override_from_previous
# - glob: ./single_file.txt
# name_template: file.txt # note that this only works if glob matches 1 file only
# https://goreleaser.com/customization/changelog/
changelog:
skip: false
use: github
sort: asc
abbrev: 0
groups:
- title: Features
regexp: ^.*?feat(\([[:word:]]+\))??!?:.+$
order: 0
- title: Bug fixes
regexp: ^.*?fix(\([[:word:]]+\))??!?:.+$
order: 1
- title: Refactoring
regexp: ^.*?refactor(\([[:word:]]+\))??!?:.+$
order: 2
- title: Documentation
regexp: ^.*?docs(\([[:word:]]+\))??!?:.+$
order: 3
- title: Chores
regexp: ^.*?chore(\([[:word:]]+\))??!?:.+$
order: 4
- title: Continuous integration
regexp: ^.*?ci(\([[:word:]]+\))??!?:.+$
order: 5
- title: Project building
regexp: ^.*?build(\([[:word:]]+\))??!?:.+$
order: 6
- title: Linting and static analysis
regexp: ^.*?build(\([[:word:]]+\))??!?:.+$
order: 7
- title: Release preparation
regexp: ^.*?relprep(\([[:word:]]+\))??!?:.+$
order: 8
- title: Other
order: 999

0 comments on commit a1dd8ef

Please sign in to comment.