Skip to content

Commit 9df593b

Browse files
committed
chore: add github actions
1 parent 97f72dc commit 9df593b

1 file changed

Lines changed: 64 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Test, Build and Release Rorsch
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
release:
10+
name: Build and Release
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
17+
- name: Set up Go
18+
uses: actions/setup-go@v5
19+
with:
20+
go-version: '1.24'
21+
22+
- name: Run tests
23+
run: go test ./...
24+
25+
- name: Set version variable
26+
id: vars
27+
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
28+
29+
- name: Build and package binaries
30+
run: |
31+
mkdir -p dist
32+
NAME="rorsch"
33+
34+
# Build
35+
GOOS=linux GOARCH=amd64 go build -o ${NAME} ./cmd/rorsch
36+
tar -czf dist/${NAME}-${VERSION}-linux-amd64.tar.gz ${NAME}
37+
rm ${NAME}
38+
39+
GOOS=darwin GOARCH=amd64 go build -o ${NAME} ./cmd/rorsch
40+
tar -czf dist/${NAME}-${VERSION}-darwin-amd64.tar.gz ${NAME}
41+
rm ${NAME}
42+
43+
GOOS=windows GOARCH=amd64 go build -o ${NAME}.exe ./cmd/rorsch
44+
zip -j dist/${NAME}-${VERSION}-windows-amd64.zip ${NAME}.exe
45+
rm ${NAME}.exe
46+
47+
- name: Generate checksums
48+
run: |
49+
cd dist
50+
sha256sum * > checksums.txt
51+
cd ..
52+
53+
- name: Create GitHub Release
54+
uses: softprops/action-gh-release@v2
55+
with:
56+
name: Release ${{ env.VERSION }}
57+
tag_name: ${{ env.VERSION }}
58+
files: |
59+
dist/*.tar.gz
60+
dist/*.zip
61+
dist/checksums.txt
62+
env:
63+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
64+

0 commit comments

Comments
 (0)