11name : CMake Build and Release
22
33permissions :
4- contents : write # Required to create tags/releases
4+ contents : write
55
66on :
77 push :
@@ -27,13 +27,13 @@ jobs:
2727 build-essential \
2828 cmake \
2929 git \
30- zip \
3130 libgl1-mesa-dev \
3231 libx11-dev \
3332 libxrandr-dev \
3433 libxi-dev \
3534 libxcursor-dev \
36- libxinerama-dev
35+ libxinerama-dev \
36+ zip
3737
3838 - name : Configure CMake (Linux)
3939 run : |
@@ -46,10 +46,17 @@ jobs:
4646 cd build
4747 cmake --build . --config Release
4848
49- - name : Zip build artifacts (Linux)
49+ - name : Zip Linux executable only
5050 run : |
51- # Zip the contents of build/ into linux-x86_64.zip at repo root
52- zip -r linux-x86_64.zip build/*
51+ cd build
52+ # Replace 'game' with your actual executable name
53+ if [ -f game ]; then
54+ zip -j ../linux-x86_64.zip game
55+ else
56+ echo "Executable not found!"
57+ exit 1
58+ fi
59+ cd ..
5360
5461 - name : Upload Linux artifact
5562 uses : actions/upload-artifact@v4
7784 cd build
7885 cmake --build . --config Release
7986
80- - name : Zip build artifacts (Windows)
87+ - name : Zip Windows executable only
8188 run : |
82- powershell Compress-Archive -Path build\* -DestinationPath windows-x86_64.zip
89+ # Adjust path if using multi-config generator
90+ $exe = "build\Release\game.exe"
91+ if (Test-Path $exe) {
92+ Compress-Archive -Path $exe -DestinationPath windows-x86_64.zip -Force
93+ } else {
94+ Write-Error "Executable not found at $exe"
95+ exit 1
96+ }
8397
8498 - name : Upload Windows artifact
8599 uses : actions/upload-artifact@v4
96110 - name : Checkout code
97111 uses : actions/checkout@v4
98112
99- # Download both artifacts to the root folder
100113 - name : Download Linux artifact
101114 uses : actions/download-artifact@v4
102115 with :
@@ -109,7 +122,6 @@ jobs:
109122 name : windows-x86_64
110123 path : .
111124
112- # Create tag automatically (starting at v1.0.0)
113125 - name : Create tag
114126 id : tag
115127 env :
@@ -136,9 +148,8 @@ jobs:
136148 git tag $new_tag
137149 git push https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git $new_tag
138150 echo "tag=$new_tag" >> $GITHUB_OUTPUT
139- sleep 5 # wait for GitHub to register the tag
151+ sleep 5
140152
141- # Create GitHub release and attach both zipped artifacts
142153 - name : Create GitHub Release with artifacts
143154 uses : softprops/action-gh-release@v1
144155 with :
0 commit comments