Skip to content

Commit c321c7d

Browse files
committed
fix: update GitHub Actions workflow for proper artifact handling
1 parent 114fc8a commit c321c7d

File tree

1 file changed

+70
-37
lines changed

1 file changed

+70
-37
lines changed

.github/workflows/build.yaml

Lines changed: 70 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -3,73 +3,106 @@ name: Build and Release
33
on:
44
push:
55
tags:
6-
- 'v*'
6+
- 'v*.*.*' # Matches semantic version tags
77

88
jobs:
99
build:
1010
runs-on: ubuntu-latest
1111
strategy:
1212
matrix:
13-
goos: [linux, darwin, windows]
14-
goarch: [amd64, arm64]
15-
exclude:
16-
- goos: windows
17-
goarch: arm64 # Windows ARM64 is not commonly supported
13+
include:
14+
- os: linux
15+
arch: amd64
16+
- os: linux
17+
arch: arm64
18+
- os: windows
19+
arch: amd64
20+
- os: windows
21+
arch: arm64
22+
- os: darwin
23+
arch: amd64
24+
- os: darwin
25+
arch: arm64
26+
1827
steps:
1928
- uses: actions/checkout@v4
20-
21-
- name: Set up Go
22-
uses: actions/setup-go@v5
2329
with:
24-
go-version: '1.23'
25-
30+
fetch-depth: 0
31+
2632
- name: Set up Node.js
2733
uses: actions/setup-node@v4
2834
with:
2935
node-version: '20'
30-
31-
- name: Install dependencies
32-
run: |
33-
cd manager && npm install
34-
36+
cache: 'npm'
37+
cache-dependency-path: manager/package-lock.json
38+
3539
- name: Build frontend
36-
run: |
37-
cd manager && npm run build
38-
40+
working-directory: manager
41+
run: npm ci && npm run build
42+
43+
- name: Set up Go
44+
uses: actions/setup-go@v5
45+
with:
46+
go-version: '1.23'
47+
check-latest: true
48+
49+
- name: Install dependencies
50+
run: go mod download
51+
52+
- name: Get version from tag
53+
id: get_version
54+
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
55+
3956
- name: Build binary
4057
env:
41-
GOOS: ${{ matrix.goos }}
42-
GOARCH: ${{ matrix.goarch }}
58+
GOOS: ${{ matrix.os }}
59+
GOARCH: ${{ matrix.arch }}
60+
CGO_ENABLED: 0
4361
run: |
44-
go build -o gorun-${{ matrix.goos }}-${{ matrix.goarch }} .
45-
if [ "${{ matrix.goos }}" = "windows" ]; then
46-
mv gorun-${{ matrix.goos }}-${{ matrix.goarch }} gorun-${{ matrix.goos }}-${{ matrix.goarch }}.exe
47-
fi
48-
49-
- name: Upload artifacts
62+
go build -o gorun-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.os == 'windows' && '.exe' || '' }} .
63+
64+
- name: Upload binary
5065
uses: actions/upload-artifact@v4
5166
with:
52-
name: gorun-${{ matrix.goos }}-${{ matrix.goarch }}
53-
path: gorun-${{ matrix.goos }}-${{ matrix.goarch }}*
54-
67+
name: gorun-${{ matrix.os }}-${{ matrix.arch }}
68+
path: gorun-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.os == 'windows' && '.exe' || '' }}
69+
5570
release:
5671
needs: build
5772
runs-on: ubuntu-latest
73+
permissions:
74+
contents: write
75+
packages: write
76+
5877
steps:
78+
- uses: actions/checkout@v4
79+
with:
80+
fetch-depth: 0
81+
5982
- name: Download all artifacts
6083
uses: actions/download-artifact@v4
6184
with:
6285
path: artifacts
63-
86+
pattern: gorun-*
87+
88+
- name: List artifacts
89+
run: find artifacts -type f
90+
6491
- name: Create Release
92+
id: create_release
6593
uses: softprops/action-gh-release@v1
6694
with:
6795
files: |
68-
artifacts/gorun-linux-amd64
69-
artifacts/gorun-linux-arm64
70-
artifacts/gorun-darwin-amd64
71-
artifacts/gorun-darwin-arm64
72-
artifacts/gorun-windows-amd64.exe
73-
generate_release_notes: true
96+
artifacts/gorun-darwin-amd64/*
97+
artifacts/gorun-darwin-arm64/*
98+
artifacts/gorun-linux-amd64/*
99+
artifacts/gorun-linux-arm64/*
100+
artifacts/gorun-windows-amd64/*
101+
artifacts/gorun-windows-arm64/*
102+
body_path: RELEASE.md
103+
draft: false
104+
prerelease: false
105+
generate_release_notes: false
106+
fail_on_unmatched_files: true
74107
env:
75108
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)