Skip to content

Commit

Permalink
revamp goreleaser
Browse files Browse the repository at this point in the history
  • Loading branch information
jftuga committed Nov 24, 2023
1 parent 06af856 commit ba19397
Show file tree
Hide file tree
Showing 2 changed files with 112 additions and 44 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
on:
workflow_dispatch:
# push:
# tags:
# - "*"

permissions:
contents: write

jobs:
build:
name: GoReleaser Build
runs-on: ubuntu-latest

steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set Up Go
uses: actions/setup-go@v4
with:
go-version: "1.x"
id: go

- name: run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
version: ~> 1.23
args: release --clean -p 2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
123 changes: 79 additions & 44 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,82 @@
project_name: nics
build:
main: .
binary: nics
env:
- CGO_ENABLED=0
goos:
- darwin
- linux
- windows
- freebsd
goarch:
- amd64
- arm
- arm64
- mips
goarm:
- 6
- 7
ignore:
- goos: freebsd
goarch: arm
- goos: freebsd
goarch: arm64
- goos: freebsd
goarch: mips
- goos: windows
goarch: arm
goarm: 7
- goos: windows
goarch: arm
goarm: 6
- goos: linux
goarch: arm64
before:
hooks:
- go mod tidy

builds:
- id: nics-id1
binary: nics
ldflags:
- -extldflags "-static" -s -w -X main.commit={{.Commit}} -X main.date={{.Date}} -X main.builtBy=goreleaser -X main.Version={{.Version}} -X main.Revision={{.ShortCommit}}
env:
- CGO_ENABLED=0
goos:
- linux
- freebsd
- darwin
goarch:
- amd64
- arm64
- arm
- ppc64le
goarm:
- "7"
ignore:
- goos: freebsd
goarch: arm64
- goos: freebsd
goarch: arm
- goos: freebsd
goarch: ppc64le
- goos: darwin
goarch: arm
- goos: darwin
goarch: ppc64le

- id: nics-id2
binary: nics
ldflags:
- -extldflags "-static" -s -w -X main.commit={{.Commit}} -X main.date={{.Date}} -X main.builtBy=goreleaser -X main.Version={{.Version}} -X main.Revision={{.ShortCommit}}
env:
- CGO_ENABLED=0
goos:
- windows
goarch:
- amd64
hooks:
post:
- upx -9 "{{ .Path }}"

archives:
- name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ .Arm }}"
format: tar.xz
format_overrides:
- goos: windows
format: zip
replacements:
darwin: macOS
wrap_in_directory: true
- name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
format: tar.xz
format_overrides:
- goos: windows
format: zip
wrap_in_directory: true
files:
- LICENSE
- README.md

checksum:
name_template: "{{ .ProjectName }}_{{ .Version }}--sha256_checksums.txt"
name_template: "{{ .ProjectName }}_{{ .Version }}--checksums.txt"
release:
draft: true
draft: false
changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"

brews:
- name: nics
repository:
owner: jftuga
name: homebrew-tap
commit_author:
name: jftuga
email: jftuga@users.noreply.github.com
homepage: https://github.com/jftuga/nics
description: "Display information about Network Interface Cards (NICs)"
test: system "#{bin}/nics -v"
install: bin.install "nics"

0 comments on commit ba19397

Please sign in to comment.