Skip to content

Commit 9e581f2

Browse files
Update release.yml
1 parent b81f4cb commit 9e581f2

1 file changed

Lines changed: 29 additions & 46 deletions

File tree

.github/workflows/release.yml

Lines changed: 29 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,50 @@
1-
name: Create Release Assets
1+
name: Release
22

33
on:
44
push:
5-
tags:
6-
- 'v*' # v1.0, v2.0.4 etc
5+
tags: ['v*']
6+
workflow_dispatch:
77

88
jobs:
9-
build_assets:
10-
name: Build Release for ${{ matrix.os }}
9+
build:
10+
name: Build ${{ matrix.os }}
1111
runs-on: ${{ matrix.os }}
1212
strategy:
13-
fail-fast: false
1413
matrix:
15-
os: [ubuntu-24.04, windows-latest] # chacge ubuntu version to latest, when letest would be 24.04+
14+
os: [ubuntu-24.04, windows-latest]
1615

1716
steps:
18-
- name: Checkout code
19-
uses: actions/checkout@v4
17+
- uses: actions/checkout@v4
2018

21-
- name: Install Build Tools (Linux)
19+
- name: Dependencies (Linux)
2220
if: runner.os == 'Linux'
23-
run: |
24-
sudo apt-get update
25-
sudo apt-get install -y build-essential cmake
26-
27-
- name: Configure CMake
28-
# C++23, GCC 14
29-
run: >
30-
cmake -S cmake_proj -B build
31-
-DCMAKE_BUILD_TYPE=Release
32-
${{ runner.os == 'Linux' && '-DCMAKE_CXX_COMPILER=g++-14 -DCMAKE_C_COMPILER=gcc-14' || '' }}
33-
-DCMAKE_CXX_FLAGS="${{ runner.os == 'Windows' && '/W3' || '-Wall' }}"
21+
run: sudo apt-get update && sudo apt-get install -y build-essential cmake
3422

3523
- name: Build
36-
run: cmake --build build --config Release
37-
38-
# ---Windows---
39-
- name: Package Windows
40-
if: runner.os == 'Windows'
4124
run: |
42-
mkdir release_dist
43-
copy build\Release\Turret_2.exe release_dist\
44-
# MSVC_dll
45-
copy libs\MSVC_dll\*.dll release_dist\ 2>$null || echo "No DLLs found"
46-
compress-archive -Path release_dist\* -DestinationPath Turret_2_win_x64.zip
25+
cmake -B build -DCMAKE_BUILD_TYPE=Release ${{ runner.os == 'Linux' && '-DCMAKE_CXX_COMPILER=g++-14' || '' }}
26+
cmake --build build --config Release
4727
48-
# ---Linux---
49-
- name: Package Linux
50-
if: runner.os == 'Linux'
28+
- name: Package
29+
shell: bash
5130
run: |
52-
mkdir release_dist
53-
cp build/Turret_2 release_dist/
54-
# GCC_so
55-
cp libs/GCC_so/*.so* release_dist/ 2>/dev/null || echo "No SOs found"
56-
tar -czvf Turret_2_linux.tar.gz -C release_dist .
57-
58-
- name: Upload to GitHub Release
31+
mkdir dist
32+
[ "${{ runner.os }}" == "Windows" ] && cp build/Release/*.exe dist/ || cp build/Turret_2 dist/
33+
34+
# copy libs and res
35+
[ -d "libs/MSVC_dll" ] && cp libs/MSVC_dll/*.dll dist/ || true
36+
[ -d "libs/GCC_so" ] && cp libs/GCC_so/*.so* dist/ || true
37+
[ -d "res" ] && cp -r res dist/ || true
38+
39+
if [ "${{ runner.os }}" == "Windows" ]; then
40+
7z a Turret_2_win.zip ./dist/*
41+
else
42+
tar -czvf Turret_2_linux.tar.gz -C dist .
43+
fi
44+
45+
- name: Release
5946
uses: softprops/action-gh-release@v2
6047
with:
61-
files: |
62-
Turret_2_win_x64.zip
63-
Turret_2_linux.tar.gz
64-
draft: false
65-
prerelease: false
48+
files: Turret_2_*
6649
env:
6750
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)