Skip to content

Commit

Permalink
ci: Testing GoReleaser configuration.
Browse files Browse the repository at this point in the history
  • Loading branch information
skyzyx committed Apr 30, 2024
1 parent 228b703 commit d0ea8c7
Show file tree
Hide file tree
Showing 2 changed files with 219 additions and 30 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,17 @@ jobs:
- name: GoReleaser Action
uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 # v5.0.0
env:
GH_PUBLIC_TOKEN: ${{ secrets.GH_PUBLIC_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
MACOS_NOTARY_ISSUER_ID: ${{ secrets.MACOS_NOTARY_ISSUER_ID }}
MACOS_NOTARY_KEY_ID: ${{ secrets.MACOS_NOTARY_KEY_ID }}
MACOS_NOTARY_KEY: ${{ secrets.MACOS_NOTARY_KEY }}
MACOS_SIGN_P12: ${{ secrets.MACOS_SIGN_P12 }}
MACOS_SIGN_PASSWORD: ${{ secrets.MACOS_SIGN_PASSWORD }}
NFPM_PASSPHRASE: "${{ secrets.GPG_PWD }}"
RSA_KEY_B64: ${{ secrets.RSA_KEY_B64 }}
with:
distribution: goreleaser-pro
version: latest
Expand Down
241 changes: 211 additions & 30 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,45 +1,74 @@
---
project_name: terraform-provider-corefunc
project_name: crowdstrike-falcon-downloader
dist: ./dist

# https://goreleaser.com/customization/templates/#custom-variables
variables:
MaintainerName: Northwood Labs
MaintainerEmail: [email protected]
Description: |-
CLI/TUI for downloading sensors for CrowdStrike Falcon.
# https://goreleaser.com/customization/reportsizes/
report_sizes: true

# https://goreleaser.com/customization/builds/
builds:
- env:
- CGO_ENABLED=0
- id: linux
binary: {{ .ProjectName }}
skip: false
mod_timestamp: '{{ .CommitTimestamp }}'
env:
- CGO_ENABLED=0
flags:
- -trimpath
ldflags:
- -s -w -X github.com/northwood-labs/crowdstrike-falcon-downloader/cmd.Version={{.Version}}
- -s -w -X github.com/northwood-labs/{{ .ProjectName }}/cmd.Version={{ .Version }}
goos:
- darwin
- freebsd
- linux
- netbsd
- openbsd
goarch:
- amd64
- arm64

- id: windows
binary: {{ .ProjectName }}
skip: false
mod_timestamp: '{{ .CommitTimestamp }}'
env:
- CGO_ENABLED=0
flags:
- -trimpath
ldflags:
- -s -w -X github.com/northwood-labs/{{ .ProjectName }}/cmd.Version={{ .Version }}
goos:
- windows
goarch:
- '386'
- amd64
- arm
- arm64
ignore:
- goos: darwin
goarch: '386'
- goos: darwin
goarch: arm
- goos: openbsd
goarch: arm
- goos: openbsd
goarch: arm64
- goos: netbsd
goarch: arm
- goos: netbsd
goarch: arm64
binary: '{{ .ProjectName }}_v{{ .Version }}'

- id: macos
binary: {{ .ProjectName }}
skip: false
mod_timestamp: '{{ .CommitTimestamp }}'
env:
- CGO_ENABLED=0
flags:
- -trimpath
ldflags:
- -s -w -X github.com/northwood-labs/{{ .ProjectName }}/cmd.Version={{ .Version }}
goos:
- darwin
goarch:
- amd64
- arm64

# https://goreleaser.com/customization/universalbinaries/
universal_binaries:
- id: macos-universal
ids:
- macos
name_template: "{{ .ProjectName }}"
replace: true

# https://goreleaser.com/customization/archive/
archives:
Expand All @@ -53,7 +82,12 @@ checksum:

# https://goreleaser.com/customization/sign/
signs:
- artifacts: checksum
- id: gpg
ids:
- linux-archive
- windows-archive
signature: "${artifact}.sig"
artifacts: all
args:
- --batch
- --local-user
Expand All @@ -65,16 +99,163 @@ signs:

# https://goreleaser.com/customization/release/
release:
# Visit your project's GitHub Releases page to publish this release.
github:
owner: northwood-labs
name: {{ .ProjectName }}
draft: true
replace_existing_draft: true
replace_existing_artifacts: true
prerelease: auto
make_latest: true
mode: replace
# extra_files:
# - glob: terraform-registry-manifest.json
# name_template: "{{ .ProjectName }}_{{ .Version }}_manifest.json"
name_template: '{{.Version}} — {{time "2006-01-02"}}'
name_template: '{{ .Version }} — {{ time "2006-01-02" }}'

# https://goreleaser.com/customization/changelog/
changelog:
skip: false
use: github-native

# https://goreleaser.com/customization/source/
source:
rlcp: true
enabled: true
name_template: '{{ .ProjectName }}-src'
format: tar.gz

# https://goreleaser.com/customization/archive/
archives:
- id: "linux-archive"
rlcp: true
builds:
- linux
allow_different_binary_count: false
wrap_in_directory: false
format: zip
files:
- none*
name_template: '{{ .ProjectName }}-{{ .Os }}-{{ .Arch }}{{ with .Arm }}32v{{ . }}{{ end }}{{ if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{ end }}'

- id: "windows-archive"
rlcp: true
builds:
- windows
allow_different_binary_count: false
wrap_in_directory: false
format: zip
files:
- none*
name_template: '{{ .ProjectName }}-{{ .Os }}-{{ .Arch }}{{ with .Arm }}32v{{ . }}{{ end }}{{ if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{ end }}'

- id: "macos-archive"
rlcp: true
builds:
- macos-universal
allow_different_binary_count: false
wrap_in_directory: false
format: zip
files:
- none*
name_template: "{{ .ProjectName }}-{{ .Os }}-universal"

# https://goreleaser.com/customization/nfpm/
nfpms:
- id: rpm
builds:
- linux
package_name: '{{ .ProjectName }}'
vendor: '{{ .Var.MaintainerName }}'
homepage: 'https://github.com/northwood-labs/{{ .ProjectName }}'
description: '{{.Var.Description}}'
maintainer: '{{ .Var.MaintainerName }} <{{ .Var.MaintainerEmail }}>'
file_name_template: "{{ .ConventionalFileName }}"
umask: 0o002
formats:
- rpm
bindir: /usr/local/bin
epoch: '1'
release: '1'
rpm:
compression: lzma

- id: deb
builds:
- linux
package_name: '{{ .ProjectName }}'
vendor: '{{ .Var.MaintainerName }}'
homepage: 'https://github.com/northwood-labs/{{ .ProjectName }}'
description: '{{.Var.Description}}'
maintainer: '{{ .Var.MaintainerName }} <{{ .Var.MaintainerEmail }}>'
file_name_template: "{{ .ConventionalFileName }}"
umask: 0o002
formats:
- deb
bindir: /usr/local/bin
epoch: '1'
release: '1'

- id: apk
builds:
- linux
package_name: '{{ .ProjectName }}'
vendor: '{{ .Var.MaintainerName }}'
homepage: 'https://github.com/northwood-labs/{{ .ProjectName }}'
description: '{{.Var.Description}}'
maintainer: '{{ .Var.MaintainerName }} <{{ .Var.MaintainerEmail }}>'
file_name_template: "{{ .ConventionalFileName }}"
umask: 0o002
formats:
- apk
bindir: /usr/local/bin
epoch: '1'
release: '1'

# https://goreleaser.com/customization/notarize/
notarize:
macos:
- enabled: '{{ isEnvSet "MACOS_SIGN_P12 }}'
ids:
- macos-archive
sign:
certificate: "{{ .Env.MACOS_SIGN_P12 }}"
password: "{{ .Env.MACOS_SIGN_PASSWORD }}"
notarize:
issuer_id: "{{ .Env.MACOS_NOTARY_ISSUER_ID }}"
key_id: "{{ .Env.MACOS_NOTARY_KEY_ID }}"
key: "{{ .Env.MACOS_NOTARY_KEY }}"
wait: true
timeout: 30m

# https://goreleaser.com/customization/homebrew/
brews:
- name: '{{ .ProjectName }}'
# alternative_names:
# - myproject@{{ .Version }}
# - myproject@{{ .Major }}
ids:
- macos-archive
- linux-archive
url_template: "https://github.com/northwood-labs/{{ .ProjectName }}/releases/download/{{ .Tag }}/{{ .ArtifactName }}"
url_headers:
- "Accept: application/octet-stream"
- 'Authorization: Bearer #{ENV["HOMEBREW_GITHUB_API_TOKEN"]}'
download_strategy: CurlDownloadStrategy
commit_author:
name: '{{ .Var.MaintainerName }}'
email: '{{ .Var.MaintainerEmail }}'
commit_msg_template: "automation: Brew formula update for {{ .ProjectName }} version {{ .Tag }}."
directory: Formula
caveats: "This is a macOS Universal Binary that should work on Intel and Apple Silicon chips."
homepage: "https://github.com/northwood-labs/{{ .ProjectName }}"
description: '{{ .Var.Description }}'
license: Apache-2.0
skip_upload: false
test: |
system "#{bin}/{{ .ProjectName }} version"
repository:
owner: northwood-labs
name: '{{ .ProjectName }}'
branch: main
token: "{{ .Env.GH_PUBLIC_TOKEN }}"
token_type: "github"
git:
url: 'https://{{ .Env.GH_PUBLIC_TOKEN }}@github.com/northwood-labs/homebrew-tap.git'

0 comments on commit d0ea8c7

Please sign in to comment.