-
Notifications
You must be signed in to change notification settings - Fork 0
/
.goreleaser.yml
147 lines (138 loc) · 4.23 KB
/
.goreleaser.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# =============================================================================
# GoReleaser Configuration to release various binaries
# =============================================================================
# It will:
# - Cross compile for all supported platforms. macOS, Linux and Windows.
# - Releases the artifacts to the assets of releases page in GitHub.
# - Creates Homebrew tap and formula for macOS and Linux system.
# - Creates Docker images and manifest file.
#
# For local-test run:
# $ goreleaser release --snapshot --skip-publish --rm-dist
# $ # *Note: Check the ./bin/ dir after ran.
#
# Make sure to check the documentation as well at:
# https://goreleaser.com/customization/
# =============================================================================
# Download Go modules
before:
hooks:
- go mod download
# Name to use on test release with --snapshot option.
snapshot:
name_template: '{{ .Version }}'
# Directory name to distribute
dist: bin
# Enable signing
signs:
- artifacts: checksum
args: ["--batch", "-u", "{{ .Env.GPG_FINGERPRINT }}", "--output", "${signature}", "--detach-sign", "${artifact}"]
# Settings to build the binaries.
builds:
-
# Target directory of main.go package
main: ./cmd/whereami
# Output binary name
binary: whereami
env:
- CGO_ENABLED=0
# Target OS
goos:
- linux
- windows
- darwin
# Target architectures
goarch:
- amd64
- arm
- arm64
# Variant for ARM32
goarm:
- "5"
- "6"
- "7"
# Ignore ARM32/ARM64 build for both macOS and Windows
ignore:
- goos: darwin
goarch: arm
- goos: windows
goarch: arm
# Build the app as static binary and embed version and commit info
ldflags:
- -s -w -extldflags '-static' -X 'main.version={{.Version}}' -X 'main.commit={{ .ShortCommit }}'
# macOS universal binaries for both amd64(x86_64) and amd64(M1)
universal_binaries:
-
name_template: 'whereami'
# Combine arm64 and amd64 as a single binary and remove each
replace: true
# Archiving the built binaries
archives:
-
replacements:
darwin: macOS
linux: Linux
windows: Windows
amd64: x86_64
format_overrides:
- goos: windows
format: zip
- goos: darwin
format: zip
# Create checksum file of archived files
checksum:
name_template: 'checksums.txt'
# Release/update Homebrew tap repository
brews:
-
# Name of the Homebrew package: /<TAP REPO ROOT DIR>/Formula/<name>.rb
name: whereami
# Target repo to tap: KEINOS/homebrew-apps
tap:
owner: KEINOS
name: homebrew-apps
# Target directory: KEINOS/homebrew-apps/Formula
folder: Formula
# URL of the archive in releases page
url_template: "https://github.com/KEINOS/whereami/releases/download/{{ .Tag }}/{{ .ArtifactName }}"
# Author info to commit to the tap repo
commit_author:
name: goreleaserbot
email: goreleaser@carlosbecker.com
# Message to display on `brew search` or `brew info`
description: "This is a command line utility that prints the current global/public IP address."
homepage: "https://github.com/KEINOS/whereami/"
# Let brew command pull the archive via cURL
download_strategy: CurlDownloadStrategy
# Let brew command instll the binary as `whereami`
install: |
bin.install "whereami"
# Smoke test to run after install
test: |
system "#{bin}/whereami --version"
# Build Docker image for amd64 and arm64
dockers:
- image_templates:
- "keinos/whereami:{{ .Version }}-amd64"
use: buildx
goarch: amd64
dockerfile: .github/Dockerfile_release
build_flag_templates:
- "--platform=linux/amd64"
- image_templates:
- "keinos/whereami:{{ .Version }}-arm64"
use: buildx
goarch: arm64
dockerfile: .github/Dockerfile_release
build_flag_templates:
- "--platform=linux/arm64"
# Build multiarch manifest file of Docker image
docker_manifests:
- name_template: keinos/whereami:{{ .Version }}
image_templates:
- keinos/whereami:{{ .Version }}-amd64
- keinos/whereami:{{ .Version }}-arm64
- name_template: keinos/whereami:latest
image_templates:
- keinos/whereami:{{ .Version }}-amd64
- keinos/whereami:{{ .Version }}-arm64