Skip to content

Commit 2686d6f

Browse files
committed
ci(release): move GoReleaser config to root and fix GitHub Action workflow
1 parent e347a66 commit 2686d6f

2 files changed

Lines changed: 84 additions & 49 deletions

File tree

.github/workflows/release.yml

Lines changed: 29 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,35 @@
1-
version: 2
1+
name: Release
22

3-
before:
4-
hooks:
5-
- go mod tidy
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
67

7-
builds:
8-
- id: cortex
9-
main: ./cmd/cortex
10-
binary: cortex
11-
env:
12-
- CGO_ENABLED=0
13-
goos:
14-
- linux
15-
- windows
16-
- darwin
17-
goarch:
18-
- amd64
19-
- arm64
20-
ldflags:
21-
- -s -w
22-
- -X github.com/hamza-hafeez82/cortex/internal/version.Version={{.Version}}
23-
- -X github.com/hamza-hafeez82/cortex/internal/version.Commit={{.Commit}}
24-
- -X github.com/hamza-hafeez82/cortex/internal/version.Date={{.Date}}
8+
permissions:
9+
contents: write
2510

26-
archives:
27-
- id: cortex
28-
name_template: "cortex_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
29-
format_overrides:
30-
- goos: windows
31-
format: zip
32-
files:
33-
- README.md
34-
- LICENSE
11+
jobs:
12+
release:
13+
name: Release
14+
runs-on: ubuntu-latest
3515

36-
checksum:
37-
name_template: "checksums.txt"
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
3821

39-
changelog:
40-
sort: asc
41-
filters:
42-
exclude:
43-
- "^docs:"
44-
- "^test:"
45-
- "^chore:"
46-
- Merge pull request
47-
- Merge branch
22+
- name: Set up Go
23+
uses: actions/setup-go@v5
24+
with:
25+
go-version: '1.22'
26+
cache: true
4827

49-
release:
50-
github:
51-
owner: hamza-hafeez82
52-
name: cortex
53-
draft: false
54-
prerelease: auto
55-
name_template: "Cortex {{.Version}}"
28+
- name: Run GoReleaser
29+
uses: goreleaser/goreleaser-action@v6
30+
with:
31+
distribution: goreleaser
32+
version: latest
33+
args: release --clean
34+
env:
35+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.goreleaser.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
version: 2
2+
3+
before:
4+
hooks:
5+
- go mod tidy
6+
7+
builds:
8+
- id: cortex
9+
main: ./cmd/cortex
10+
binary: cortex
11+
env:
12+
- CGO_ENABLED=0
13+
goos:
14+
- linux
15+
- windows
16+
- darwin
17+
goarch:
18+
- amd64
19+
- arm64
20+
ldflags:
21+
- -s -w
22+
- -X github.com/hamza-hafeez82/cortex/internal/version.Version={{.Version}}
23+
- -X github.com/hamza-hafeez82/cortex/internal/version.Commit={{.Commit}}
24+
- -X github.com/hamza-hafeez82/cortex/internal/version.Date={{.Date}}
25+
26+
archives:
27+
- id: cortex
28+
name_template: "cortex_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
29+
format_overrides:
30+
- goos: windows
31+
format: zip
32+
files:
33+
- README.md
34+
- LICENSE
35+
36+
checksum:
37+
name_template: "checksums.txt"
38+
39+
changelog:
40+
sort: asc
41+
filters:
42+
exclude:
43+
- "^docs:"
44+
- "^test:"
45+
- "^chore:"
46+
- Merge pull request
47+
- Merge branch
48+
49+
release:
50+
github:
51+
owner: hamza-hafeez82
52+
name: cortex
53+
draft: false
54+
prerelease: auto
55+
name_template: "Cortex {{.Version}}"

0 commit comments

Comments
 (0)