-
-
Notifications
You must be signed in to change notification settings - Fork 2
94 lines (80 loc) · 2.65 KB
/
Copy pathrelease.yml
File metadata and controls
94 lines (80 loc) · 2.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: Release
on:
push:
branches:
- release
tags:
- 'v*'
permissions:
contents: write
jobs:
release:
name: Build and Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.24'
cache: true
cache-dependency-path: "**/*.sum"
- name: Get Go cache paths
id: go-cache-paths
run: |
echo "go-build=$(go env GOCACHE)" >> $GITHUB_OUTPUT
echo "go-mod=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT
- name: Cache Go build
uses: actions/cache@v4
with:
path: |
${{ steps.go-cache-paths.outputs.go-build }}
${{ steps.go-cache-paths.outputs.go-mod }}
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum', 'go.work') }}
restore-keys: |
${{ runner.os }}-go-
- name: Build binaries
run: |
set -e
echo "Workspace: $GITHUB_WORKSPACE"
ls -la $GITHUB_WORKSPACE
mkdir -p dist
# Explicitly set GOWORK
export GOWORK=$GITHUB_WORKSPACE/go.work
# Ensure workspace is synced
go work sync
platforms=(
"linux/amd64"
"linux/arm64"
"darwin/amd64"
"darwin/arm64"
"windows/amd64"
"windows/arm64"
"android/arm64"
)
for platform in "${platforms[@]}"; do
platform_split=(${platform//\// })
GOOS=${platform_split[0]}
GOARCH=${platform_split[1]}
output_name="vibeaura-${GOOS}-${GOARCH}"
if [ "$GOOS" == "windows" ]; then
output_name+=".exe"
fi
echo "Building for $GOOS/$GOARCH..."
CGO_ENABLED=0 GOOS=$GOOS GOARCH=$GOARCH go build -ldflags="-s -w" -trimpath -o "dist/$output_name" ./cmd/vibeaura
done
- name: Create Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/release'
with:
files: dist/*
tag_name: ${{ github.ref_name == 'release' && format('latest-{0}', github.sha) || github.ref_name }}
name: ${{ github.ref_name == 'release' && format('Release (latest-{0})', github.sha) || github.ref_name }}
generate_release_notes: true
draft: false
prerelease: ${{ github.ref == 'refs/heads/release' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}