Skip to content

Commit 10ffd11

Browse files
committed
added auto build and release
1 parent 02808ba commit 10ffd11

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

.github/workflows/publish.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: publish
2+
3+
on:
4+
push:
5+
paths:
6+
- "**.go"
7+
- ".github/workflows/publish.yml"
8+
9+
jobs:
10+
build-and-release:
11+
name: Build and Release Binaries
12+
runs-on: ubuntu-latest
13+
14+
permissions:
15+
contents: write
16+
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
21+
- name: Set up Go
22+
uses: actions/setup-go@v5
23+
with:
24+
go-version: "1.22"
25+
26+
- name: Set version
27+
id: version
28+
run: echo "VERSION=v0.2.0" >> $GITHUB_OUTPUT
29+
30+
- name: Build binaries
31+
run: |
32+
mkdir -p build
33+
GOOS=linux GOARCH=amd64 go build -o build/gstats-linux .
34+
GOOS=windows GOARCH=amd64 go build -o build/gstats-windows.exe .
35+
GOOS=darwin GOARCH=amd64 go build -o build/gstats-macos .
36+
37+
- name: Create GitHub Release
38+
uses: softprops/action-gh-release@v2
39+
with:
40+
tag_name: ${{ steps.version.outputs.VERSION }}
41+
name: gstats ${{ steps.version.outputs.VERSION }}
42+
files: |
43+
build/gstats-linux
44+
build/gstats-windows.exe
45+
build/gstats-macos
46+
env:
47+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)