Skip to content

Commit 6704071

Browse files
committed
chore: add goreleaser workflow
1 parent 0528630 commit 6704071

File tree

5 files changed

+98
-0
lines changed

5 files changed

+98
-0
lines changed

.github/workflows/release.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
tags:
7+
- 'v*'
8+
9+
permissions:
10+
contents: write
11+
12+
jobs:
13+
goreleaser:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Check out code
17+
uses: actions/checkout@v3
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Set up Go
22+
uses: actions/setup-go@v5
23+
24+
- name: Run GoReleaser
25+
uses: goreleaser/goreleaser-action@v6
26+
with:
27+
distribution: goreleaser
28+
version: 'latest'
29+
args: release --clean
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
build/
2+
dist/
3+
mise.toml
4+
.mise.toml
5+
.env

.goreleaser.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
version: 2
2+
project_name: cartomancer
3+
builds:
4+
- env:
5+
- CGO_ENABLED=0
6+
goos:
7+
- linux
8+
goarch:
9+
- amd64
10+
flags:
11+
- -trimpath
12+
ldflags:
13+
- -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}}
14+
dir: ./src
15+
binary: cartomancer-linux-amd64
16+
17+
archives: []
18+
19+
release:
20+
github:
21+
owner: arcanaland
22+
name: cartomancer
23+
draft: false
24+
prerelease: false
25+
name_template: "{{ .ProjectName }}-v{{ .Version }}"
26+
extra_files:
27+
- glob: "./**/cartomancer-linux-amd64"
28+
29+
checksum:
30+
name_template: "{{ .ProjectName }}_{{ .Version }}_checksums.txt"
31+
32+
changelog:
33+
sort: asc
34+
filters:
35+
exclude:
36+
- "^chore:"
37+
- "^test:"

Justfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
build:
2+
rm -rf build
3+
mkdir build
4+
go build -o build/cartomancer ./...
5+
6+
release version="0.2.0":
7+
git tag v{{version}}
8+
git push origin v{{version}}
9+
10+
release-local version="0.2.0":
11+
#!/bin/bash
12+
. .env
13+
git tag v{{version}}
14+
goreleaser release
15+

lefthook.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
pre-commit:
2+
commands:
3+
gofmt:
4+
run: |
5+
set -e
6+
for file in $(git diff --cached --name-only --diff-filter=ACM | grep '\.go$'); do
7+
gofmt -w "$file"
8+
git add "$file"
9+
done
10+
glob: "*.go"

0 commit comments

Comments
 (0)