Skip to content

Commit 65e4cac

Browse files
Add GoReleaser for automated binary releases
- Add .goreleaser.yaml with multi-platform builds (linux/darwin/windows, amd64/arm64) - Update CI workflow to run GoReleaser on version tags - Add snapshot builds on main branch pushes - Include Homebrew tap and deb/rpm package support - Update .gitignore to exclude AI assistant config files
1 parent 7c54da4 commit 65e4cac

3 files changed

Lines changed: 175 additions & 13 deletions

File tree

.github/workflows/ci.yml

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ name: CI
33
on:
44
push:
55
branches: [main]
6+
tags:
7+
- 'v*'
68
pull_request:
79
branches: [main]
810

@@ -47,6 +49,32 @@ jobs:
4749
version: latest
4850

4951
release:
52+
needs: [test, lint]
53+
runs-on: ubuntu-latest
54+
if: startsWith(github.ref, 'refs/tags/v')
55+
permissions:
56+
contents: write
57+
steps:
58+
- uses: actions/checkout@v4
59+
with:
60+
fetch-depth: 0
61+
62+
- name: Set up Go
63+
uses: actions/setup-go@v5
64+
with:
65+
go-version: '1.21'
66+
67+
- name: Run GoReleaser
68+
uses: goreleaser/goreleaser-action@v6
69+
with:
70+
distribution: goreleaser
71+
version: '~> v2'
72+
args: release --clean
73+
env:
74+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
75+
76+
# Build binaries on main branch pushes (without releasing)
77+
build:
5078
needs: [test, lint]
5179
runs-on: ubuntu-latest
5280
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
@@ -60,19 +88,12 @@ jobs:
6088
with:
6189
go-version: '1.21'
6290

63-
- name: Build binaries
64-
run: |
65-
mkdir -p dist
66-
VERSION=$(git describe --tags --always --dirty 2>/dev/null || echo "dev")
67-
COMMIT=$(git rev-parse --short HEAD)
68-
DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
69-
LDFLAGS="-X main.version=${VERSION} -X main.commit=${COMMIT} -X main.date=${DATE}"
70-
71-
GOOS=darwin GOARCH=amd64 go build -ldflags="${LDFLAGS}" -o dist/cryptoscan-darwin-amd64 ./cmd/cryptoscan
72-
GOOS=darwin GOARCH=arm64 go build -ldflags="${LDFLAGS}" -o dist/cryptoscan-darwin-arm64 ./cmd/cryptoscan
73-
GOOS=linux GOARCH=amd64 go build -ldflags="${LDFLAGS}" -o dist/cryptoscan-linux-amd64 ./cmd/cryptoscan
74-
GOOS=linux GOARCH=arm64 go build -ldflags="${LDFLAGS}" -o dist/cryptoscan-linux-arm64 ./cmd/cryptoscan
75-
GOOS=windows GOARCH=amd64 go build -ldflags="${LDFLAGS}" -o dist/cryptoscan-windows-amd64.exe ./cmd/cryptoscan
91+
- name: Build snapshot
92+
uses: goreleaser/goreleaser-action@v6
93+
with:
94+
distribution: goreleaser
95+
version: '~> v2'
96+
args: build --snapshot --clean
7697

7798
- name: Upload artifacts
7899
uses: actions/upload-artifact@v4

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,9 @@ build/
3939
.env
4040
.env.local
4141
config.local.yaml
42+
43+
# AI assistant files
44+
CLAUDE.md
45+
.cursorrules
46+
.aider*
47+
.copilot/

.goreleaser.yaml

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
2+
# GoReleaser configuration for CryptoScan
3+
# Documentation: https://goreleaser.com
4+
5+
version: 2
6+
7+
project_name: cryptoscan
8+
9+
before:
10+
hooks:
11+
- go mod tidy
12+
- go generate ./...
13+
14+
builds:
15+
- id: cryptoscan
16+
main: ./cmd/cryptoscan
17+
binary: cryptoscan
18+
env:
19+
- CGO_ENABLED=0
20+
goos:
21+
- linux
22+
- darwin
23+
- windows
24+
goarch:
25+
- amd64
26+
- arm64
27+
ldflags:
28+
- -s -w
29+
- -X main.version={{.Version}}
30+
- -X main.commit={{.ShortCommit}}
31+
- -X main.date={{.Date}}
32+
33+
archives:
34+
- id: default
35+
format: tar.gz
36+
name_template: >-
37+
{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}
38+
format_overrides:
39+
- goos: windows
40+
format: zip
41+
files:
42+
- LICENSE
43+
- README.md
44+
45+
checksum:
46+
name_template: 'checksums.txt'
47+
algorithm: sha256
48+
49+
snapshot:
50+
version_template: "{{ incpatch .Version }}-next"
51+
52+
changelog:
53+
sort: asc
54+
use: github
55+
filters:
56+
exclude:
57+
- '^docs:'
58+
- '^test:'
59+
- '^ci:'
60+
- '^chore:'
61+
- Merge pull request
62+
- Merge branch
63+
groups:
64+
- title: Features
65+
regexp: '^.*?feat(\([[:word:]]+\))??!?:.+$'
66+
order: 0
67+
- title: Bug Fixes
68+
regexp: '^.*?fix(\([[:word:]]+\))??!?:.+$'
69+
order: 1
70+
- title: Security
71+
regexp: '^.*?sec(\([[:word:]]+\))??!?:.+$'
72+
order: 2
73+
- title: Others
74+
order: 999
75+
76+
release:
77+
github:
78+
owner: csnp
79+
name: qramm-cryptoscan
80+
draft: false
81+
prerelease: auto
82+
mode: replace
83+
header: |
84+
## CryptoScan {{ .Tag }}
85+
86+
**Cryptographic discovery tool for the post-quantum era**
87+
88+
Part of the [QRAMM Toolkit](https://qramm.org) by [CSNP](https://csnp.org)
89+
footer: |
90+
---
91+
92+
### Quick Install
93+
94+
```bash
95+
# Using Go
96+
go install github.com/csnp/qramm-cryptoscan/cmd/cryptoscan@{{ .Tag }}
97+
98+
# Or download binary from assets below
99+
```
100+
101+
### Checksums
102+
103+
Verify your download with the checksums.txt file.
104+
105+
brews:
106+
- name: cryptoscan
107+
repository:
108+
owner: csnp
109+
name: homebrew-tap
110+
token: "{{ .Env.HOMEBREW_TAP_TOKEN }}"
111+
skip_upload: auto
112+
directory: Formula
113+
homepage: https://qramm.org
114+
description: Cryptographic discovery tool for the post-quantum era
115+
license: Apache-2.0
116+
install: |
117+
bin.install "cryptoscan"
118+
test: |
119+
system "#{bin}/cryptoscan", "--version"
120+
121+
nfpms:
122+
- id: packages
123+
package_name: cryptoscan
124+
vendor: CSNP
125+
homepage: https://qramm.org
126+
maintainer: CSNP <info@csnp.org>
127+
description: Cryptographic discovery tool for the post-quantum era
128+
license: Apache-2.0
129+
formats:
130+
- deb
131+
- rpm
132+
bindir: /usr/bin
133+
134+
announce:
135+
skip: "true"

0 commit comments

Comments
 (0)