Skip to content

Commit 458a862

Browse files
author
ujinf74
committed
Add release workflow (upload binaries on tag)
1 parent d1e380b commit 458a862

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

.github/workflows/release.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
build-and-release:
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
os: [windows-latest, ubuntu-latest, macos-latest]
17+
config: [Release]
18+
runs-on: ${{ matrix.os }}
19+
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
24+
- name: Configure (CMake)
25+
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.config }}
26+
27+
- name: Build
28+
run: cmake --build build --config ${{ matrix.config }} -j
29+
30+
- name: Test (ctest)
31+
run: ctest --test-dir build -C ${{ matrix.config }} --output-on-failure
32+
33+
# Collect artifacts (shared library)
34+
- name: Package artifacts (Windows)
35+
if: runner.os == 'Windows'
36+
shell: pwsh
37+
run: |
38+
New-Item -ItemType Directory -Force dist | Out-Null
39+
Copy-Item -Force build\Release\ballistic_c.dll dist\
40+
if (Test-Path build\Release\ballistic_c.lib) { Copy-Item -Force build\Release\ballistic_c.lib dist\ }
41+
if (Test-Path build\Release\ballistic_c.pdb) { Copy-Item -Force build\Release\ballistic_c.pdb dist\ }
42+
43+
- name: Package artifacts (Linux)
44+
if: runner.os == 'Linux'
45+
run: |
46+
mkdir -p dist
47+
cp -f build/libballistic_c.so dist/ || cp -f build/Release/libballistic_c.so dist/
48+
49+
- name: Package artifacts (macOS)
50+
if: runner.os == 'macOS'
51+
run: |
52+
mkdir -p dist
53+
cp -f build/libballistic_c.dylib dist/ || cp -f build/Release/libballistic_c.dylib dist/
54+
55+
- name: Upload to GitHub Release
56+
uses: softprops/action-gh-release@v2
57+
with:
58+
files: |
59+
dist/*

0 commit comments

Comments
 (0)