Skip to content

Commit a679038

Browse files
committed
Use goreleaser
1 parent 7db8426 commit a679038

File tree

5 files changed

+125
-1
lines changed

5 files changed

+125
-1
lines changed

.github/workflows/release.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: release
2+
on:
3+
push:
4+
tags:
5+
- "v*"
6+
7+
permissions:
8+
contents: write
9+
10+
jobs:
11+
goreleaser:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
17+
18+
- uses: actions/setup-go@v5
19+
with:
20+
go-version: stable
21+
22+
- uses: goreleaser/goreleaser-action@v6
23+
with:
24+
version: "~> v2"
25+
args: release --clean
26+
env:
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.EPITHET_BOT_TOKEN }}

.goreleaser.yaml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
version: 2
2+
project_name: epithet
3+
4+
builds:
5+
- id: epithet
6+
main: ./cmd/epithet
7+
binary: epithet
8+
env:
9+
- CGO_ENABLED=0
10+
goos:
11+
- linux
12+
- darwin
13+
- freebsd
14+
goarch:
15+
- amd64
16+
- arm64
17+
ldflags:
18+
- -s -w
19+
- -X main.version={{.Version}}
20+
- -X main.commit={{.ShortCommit}}
21+
- -X main.date={{.Date}}
22+
23+
archives:
24+
- format: tar.gz
25+
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
26+
27+
checksum:
28+
name_template: checksums.txt
29+
algorithm: sha256
30+
31+
changelog:
32+
sort: asc
33+
filters:
34+
exclude:
35+
- "^docs:"
36+
- "^test:"
37+
- "^chore:"
38+
39+
brews:
40+
- repository:
41+
owner: epithet-ssh
42+
name: homebrew-tap
43+
homepage: https://github.com/epithet-ssh/epithet
44+
description: SSH certificate authority that makes SSH certificates easy to use
45+
license: Apache-2.0
46+
install: |
47+
bin.install "epithet"
48+
49+
release:
50+
github:
51+
owner: epithet-ssh
52+
name: epithet

.tasks/closed/aj153x3d.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
title: Set up GoReleaser for automated releases
3+
id: aj153x3d
4+
created: 2025-12-05T04:42:20.683644Z
5+
updated: 2025-12-05T04:43:49.452466Z
6+
author: Brian McCallister
7+
priority: high
8+
tags:
9+
- feature
10+
---
11+
12+
---
13+
## Log
14+
15+
---
16+
# Log: 2025-12-05T04:42:20Z Brian McCallister
17+
18+
Created task.
19+
---
20+
# Log: 2025-12-05T04:42:25Z Brian McCallister
21+
22+
Started working.
23+
---
24+
# Log: 2025-12-05T04:43:49Z Brian McCallister
25+
26+
Closed: GoReleaser setup complete: .goreleaser.yaml, release workflow, version flag

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ clean-all: clean
2323
go clean -cache
2424
go clean -modcache
2525

26+
.PHONY: release-dry-run
27+
release-dry-run: ## test release locally without publishing
28+
goreleaser release --snapshot --clean --skip=publish
29+
30+
.PHONY: snapshot
31+
snapshot: ## build snapshot binaries
32+
goreleaser build --snapshot --clean
33+
2634
.PHONY: help
2735
help: ## Show this help.
2836
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'

cmd/epithet/main.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,14 @@ import (
1414
"github.com/lmittmann/tint"
1515
)
1616

17+
var (
18+
version = "dev"
19+
commit = "none"
20+
date = "unknown"
21+
)
22+
1723
var cli struct {
24+
Version kong.VersionFlag `short:"V" help:"Print version information"`
1825
Verbose int `short:"v" type:"counter" help:"Increase verbosity (-v for debug, -vv for trace)"`
1926
LogFile string `name:"log-file" help:"Path to log file (supports ~ expansion)" env:"EPITHET_LOG_FILE"`
2027
Config kong.ConfigFlag `help:"Path to config file"`
@@ -52,7 +59,10 @@ func main() {
5259
os.Exit(1)
5360
}
5461

55-
ktx := kong.Parse(&cli, kong.Resolvers(&cueResolver{value: unifiedConfig}))
62+
ktx := kong.Parse(&cli,
63+
kong.Vars{"version": version + " (" + commit + ", " + date + ")"},
64+
kong.Resolvers(&cueResolver{value: unifiedConfig}),
65+
)
5666
logger := setupLogger()
5767

5868
// Create TLS config from global flags

0 commit comments

Comments
 (0)