Skip to content

Commit 8d5941c

Browse files
ci: add GitHub Actions release workflow and versioned build support
1 parent f50ad18 commit 8d5941c

2 files changed

Lines changed: 87 additions & 5 deletions

File tree

.github/workflows/release.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
build-win32:
10+
runs-on: windows-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- name: Configure CMake
15+
run: cmake -S . -B build -DWININSPECT_BUILD_TESTS=ON
16+
17+
- name: Build
18+
run: cmake --build build --config Release
19+
20+
- name: Prepare Artifacts
21+
shell: bash
22+
run: |
23+
VERSION=${GITHUB_REF_NAME}
24+
mkdir -p dist
25+
cp build/Release/wininspectd.exe dist/wininspectd-${VERSION}-win-x64.exe
26+
cp build/Release/wininspect.exe dist/wininspect-${VERSION}-win-x64.exe
27+
cp build/Release/wininspect-gui.exe dist/wininspect-gui-${VERSION}-win-x64.exe
28+
29+
- name: Upload Win32 Artifacts
30+
uses: actions/upload-artifact@v4
31+
with:
32+
name: win32-binaries
33+
path: dist/*
34+
35+
build-portable:
36+
runs-on: ubuntu-latest
37+
steps:
38+
- uses: actions/checkout@v4
39+
40+
- name: Set up Go
41+
uses: actions/setup-go@v5
42+
with:
43+
go-version: '1.21'
44+
45+
- name: Build Portable CLI
46+
run: |
47+
VERSION=${GITHUB_REF_NAME}
48+
mkdir -p dist
49+
cd clients/portable
50+
GOOS=linux GOARCH=amd64 go build -o ../../dist/wi-portable-${VERSION}-linux-x64
51+
GOOS=windows GOARCH=amd64 go build -o ../../dist/wi-portable-${VERSION}-win-x64.exe
52+
GOOS=darwin GOARCH=amd64 go build -o ../../dist/wi-portable-${VERSION}-mac-x64
53+
GOOS=darwin GOARCH=arm64 go build -o ../../dist/wi-portable-${VERSION}-mac-arm64
54+
55+
- name: Upload Portable Artifacts
56+
uses: actions/upload-artifact@v4
57+
with:
58+
name: portable-binaries
59+
path: dist/*
60+
61+
publish:
62+
needs: [build-win32, build-portable]
63+
runs-on: ubuntu-latest
64+
permissions:
65+
contents: write
66+
steps:
67+
- name: Download all artifacts
68+
uses: actions/download-artifact@v4
69+
with:
70+
path: dist
71+
merge-multiple: true
72+
73+
- name: Create Release
74+
uses: softprops/action-gh-release@v1
75+
with:
76+
files: dist/*
77+
generate_release_notes: true

tools/winbuild-build.sh

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,31 @@ set -euo pipefail
44
WORKSPACE_DIR="$(cd "$(dirname "$0")/.." && pwd)"
55
BUILD_DIR="${WORKSPACE_DIR}/build"
66
DIST_DIR="${WORKSPACE_DIR}/dist"
7+
VERSION="${1:-dev}"
78

89
mkdir -p "${DIST_DIR}"
910

10-
echo "--- Building WinInspect Core & Win32 Clients ---"
11+
echo "--- Building WinInspect Core & Win32 Clients (Version: ${VERSION}) ---"
1112
cmake -S "${WORKSPACE_DIR}" -B "${BUILD_DIR}" -DWININSPECT_BUILD_TESTS=ON
1213
cmake --build "${BUILD_DIR}" --config Release
1314

15+
cp "${BUILD_DIR}/wininspectd.exe" "${DIST_DIR}/wininspectd-${VERSION}-win-x64.exe" 2>/dev/null || cp "${BUILD_DIR}/Release/wininspectd.exe" "${DIST_DIR}/wininspectd-${VERSION}-win-x64.exe"
16+
cp "${BUILD_DIR}/wininspect.exe" "${DIST_DIR}/wininspect-${VERSION}-win-x64.exe" 2>/dev/null || cp "${BUILD_DIR}/Release/wininspect.exe" "${DIST_DIR}/wininspect-${VERSION}-win-x64.exe"
17+
cp "${BUILD_DIR}/wininspect-gui.exe" "${DIST_DIR}/wininspect-gui-${VERSION}-win-x64.exe" 2>/dev/null || cp "${BUILD_DIR}/Release/wininspect-gui.exe" "${DIST_DIR}/wininspect-gui-${VERSION}-win-x64.exe"
18+
1419
echo "--- Building Portable CLI (Go) ---"
1520
if command -v go &> /dev/null; then
1621
pushd "${WORKSPACE_DIR}/clients/portable" > /dev/null
1722

1823
echo " Building for Linux (x64)..."
19-
GOOS=linux GOARCH=amd64 go build -o "${DIST_DIR}/wi-portable-linux-x64"
24+
GOOS=linux GOARCH=amd64 go build -o "${DIST_DIR}/wi-portable-${VERSION}-linux-x64"
2025

2126
echo " Building for Windows (x64)..."
22-
GOOS=windows GOARCH=amd64 go build -o "${DIST_DIR}/wi-portable-win-x64.exe"
27+
GOOS=windows GOARCH=amd64 go build -o "${DIST_DIR}/wi-portable-${VERSION}-win-x64.exe"
2328

2429
echo " Building for macOS (Universal)..."
25-
GOOS=darwin GOARCH=amd64 go build -o "${DIST_DIR}/wi-portable-mac-x64"
26-
GOOS=darwin GOARCH=arm64 go build -o "${DIST_DIR}/wi-portable-mac-arm64"
30+
GOOS=darwin GOARCH=amd64 go build -o "${DIST_DIR}/wi-portable-${VERSION}-mac-x64"
31+
GOOS=darwin GOARCH=arm64 go build -o "${DIST_DIR}/wi-portable-${VERSION}-mac-arm64"
2732

2833
popd > /dev/null
2934
else

0 commit comments

Comments
 (0)