Skip to content

Commit 637a2c8

Browse files
committed
ci: add release workflow for automated builds on tags
- Add new release.yml workflow that builds cross-platform binaries (linux/darwin/windows, amd64/arm64) - Workflow triggers on version tags (v*) and uploads artifacts with GitHub Releases - Update Go version to 1.25 in CI workflows - Add morrigan binary to .gitignore to exclude built artifacts
1 parent 20a6405 commit 637a2c8

3 files changed

Lines changed: 66 additions & 1 deletion

File tree

.github/workflows/go.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- name: Set up Go
1818
uses: actions/setup-go@v5
1919
with:
20-
go-version: '1.24'
20+
go-version: '1.25'
2121

2222
- name: vet
2323
run: go vet -v ./...

.github/workflows/release.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# This workflow will build and release a golang project
2+
3+
name: Release
4+
5+
on:
6+
push:
7+
tags:
8+
- 'v*'
9+
10+
permissions:
11+
contents: write
12+
13+
jobs:
14+
15+
build:
16+
runs-on: ubuntu-latest
17+
strategy:
18+
matrix:
19+
goos: [linux, darwin, windows]
20+
goarch: [amd64, arm64]
21+
steps:
22+
- uses: actions/checkout@v4
23+
24+
- name: Set up Go
25+
uses: actions/setup-go@v5
26+
with:
27+
go-version: '1.25'
28+
29+
- name: Build
30+
env:
31+
GOOS: ${{ matrix.goos }}
32+
GOARCH: ${{ matrix.goarch }}
33+
TAG: ${{ github.ref_name }}
34+
run: |
35+
ext=""
36+
if [ "$GOOS" = "windows" ]; then
37+
ext=".exe"
38+
fi
39+
LDFLAGS="-X github.com/liut/morrigan/pkg/settings.version=${TAG} -s -w"
40+
go build -ldflags="$LDFLAGS" -o morrigan-${GOOS}-${GOARCH}${ext} .
41+
42+
- name: Upload Artifact
43+
uses: actions/upload-artifact@v4
44+
with:
45+
name: morrigan-${{ matrix.goos }}-${{ matrix.goarch }}
46+
path: morrigan-*
47+
48+
release:
49+
needs: build
50+
runs-on: ubuntu-latest
51+
steps:
52+
- name: Download Artifact
53+
uses: actions/download-artifact@v4
54+
with:
55+
path: artifacts
56+
57+
- name: Upload Release Asset
58+
uses: softprops/action-gh-release@v2
59+
with:
60+
files: artifacts/morrigan-*
61+
generate_release_notes: true
62+
env:
63+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,3 +109,5 @@ htdocs/
109109
tests/
110110

111111
.idea/
112+
113+
morrigan

0 commit comments

Comments
 (0)