Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: Update .goreleaser.yml #166

Merged
merged 4 commits into from
Aug 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 19 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,23 @@ jobs:
runs-on: ${{ matrix.os }}
name: Build & Test
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.20'
- name: Build & Test
run: |
go build -v
go test ./...
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
args: release --snapshot --skip-publish --rm-dist
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v4
with:
go-version: '1.20'
- name: Build & Test
run: |
go build -v
go test ./...
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
args: release --clean --snapshot --skip-publish

# ref. https://github.com/gfx/example-github-actions-with-tty
- name: Colored Output Test
if: runner.os == 'Linux'
shell: 'script -q -e -c "bash {0}"'
run: go run main.go -- main.go
# ref. https://github.com/gfx/example-github-actions-with-tty
- name: Colored Output Test
if: runner.os == 'Linux'
shell: 'script -q -e -c "bash {0}"'
run: go run main.go -- main.go
26 changes: 14 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@ jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Unshallow Fetch
run: git fetch --prune --unshallow
- uses: actions/setup-go@v4
with:
go-version: '1.20'
- name: Release via goreleaser
uses: goreleaser/goreleaser-action@v4
with:
args: release
env:
GITHUB_TOKEN: ${{ secrets.CUSTOM_GITHUB_TOKEN }}
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: git fetch tags
run: git fetch --force --tags
- uses: actions/setup-go@v4
with:
go-version: '1.20'
- name: Release via goreleaser
uses: goreleaser/goreleaser-action@v4
with:
args: release
env:
GITHUB_TOKEN: ${{ secrets.CUSTOM_GITHUB_TOKEN }}
87 changes: 57 additions & 30 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,74 @@
before:
hooks:
- go mod tidy

snapshot:
name_template: "{{ incpatch .Version }}-next"

report_sizes: true

metadata:
mod_timestamp: "{{ .CommitTimestamp }}"

builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- darwin
- windows
ignore:
- goos: darwin
goarch: 386
- goos: windows
goarch: arm64
ldflags:
- -s -w -X github.com/toshimaru/nyan/cmd.version={{.Version}}
- env:
- CGO_ENABLED=0
goos:
- linux
- darwin
- windows
goarch:
- "386"
- amd64
- arm64
ignore:
- goos: windows
goarch: arm64
mod_timestamp: "{{ .CommitTimestamp }}"
ldflags:
- -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{ .CommitDate }} -X main.builtBy=goreleaser -X main.treeState={{ .IsGitDirty }}

archives:
- name_template: '{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}'
replacements:
darwin: Darwin
linux: Linux
windows: Windows
386: i386
amd64: x86_64
format_overrides:
- goos: windows
format: zip
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ incpatch .Version }}-next"

changelog:
sort: asc
use: github
filters:
exclude:
- '^docs:'
- '^test:'
- Merge pull request
- merge conflict
- Merge pull request
- Merge remote-tracking branch
- Merge branch
groups:
- title: "New Features"
regexp: '^.*?feat(\([[:word:]]+\))??!?:.+$'
order: 1
- title: "Bug fixes"
regexp: '^.*?fix(\([[:word:]]+\))??!?:.+$'
order: 3
- title: "Documentation updates"
regexp: ^.*?doc(\([[:word:]]+\))??!?:.+$
order: 5
- title: Dependency updates
regexp: '^.*?(feat|fix)\(deps\)!?:.+$'
order: 10

archives:
- name_template: '{{ .ProjectName }}_{{ title .Os }}_{{ .Arch }}'
format_overrides:
- goos: windows
format: zip

brews:
- tap:
- repository:
owner: toshimaru
name: homebrew-nyan
description: Colored cat command which supports syntax highlighting
homepage: https://github.com/toshimaru/nyan
license: MIT
test: |
system "#{bin}/nyan", "-v"

release:
name_template: "v{{ .Version }}"