Skip to content

Commit 4319304

Browse files
committed
ci: Add GitHub Actions workflows for CI and Release
1 parent f65ccfd commit 4319304

File tree

2 files changed

+86
-0
lines changed

2 files changed

+86
-0
lines changed

.github/workflows/ci.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ master, main ]
6+
pull_request:
7+
branches: [ master, main ]
8+
9+
jobs:
10+
lint:
11+
name: Lint
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: actions/setup-go@v5
16+
with:
17+
go-version: '1.22'
18+
- name: golangci-lint
19+
uses: golangci/golangci-lint-action@v6
20+
with:
21+
version: latest
22+
23+
test:
24+
name: Test
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v4
28+
- uses: actions/setup-go@v5
29+
with:
30+
go-version: '1.22'
31+
- name: Run tests
32+
run: make test
33+
34+
build:
35+
name: Build
36+
runs-on: ubuntu-latest
37+
needs: [lint, test]
38+
steps:
39+
- uses: actions/checkout@v4
40+
- uses: actions/setup-go@v5
41+
with:
42+
go-version: '1.22'
43+
- name: Build
44+
run: make build

.github/workflows/release.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
release:
10+
name: Release
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
17+
- uses: actions/setup-go@v5
18+
with:
19+
go-version: '1.22'
20+
21+
- name: Build All Platforms
22+
run: make build-all
23+
24+
- name: Generate Changelog
25+
id: changelog
26+
uses:
27+
# Simple placeholder, usually we use git-cliff or similar
28+
# For now, we just dump the git log since last tag
29+
run: |
30+
echo "CHANGELOG<<EOF" >> $GITHUB_ENV
31+
git log $(git describe --tags --abbrev=0 HEAD^)..HEAD --oneline >> $GITHUB_ENV
32+
echo "EOF" >> $GITHUB_ENV
33+
34+
- name: Create Release
35+
uses: softprops/action-gh-release@v1
36+
with:
37+
files: dist/*
38+
body: |
39+
## Changes
40+
${{ env.CHANGELOG }}
41+
env:
42+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)