@@ -11,28 +11,24 @@ jobs:
1111 build-and-release :
1212 runs-on : ${{ matrix.os }}
1313 permissions :
14- contents : write # Required to create releases
14+ contents : write
1515
1616 strategy :
1717 fail-fast : false
1818 matrix :
19- os : [ubuntu-latest, windows-latest]
20- build_type : [Release]
21- cpp_compiler : [g++, clang++, cl]
2219 include :
2320 - os : windows-latest
21+ build_type : Release
2422 cpp_compiler : cl
23+ artifact_suffix : " Windows-MSVC.exe" # Unique suffix for Windows
2524 - os : ubuntu-latest
25+ build_type : Release
2626 cpp_compiler : g++
27+ artifact_suffix : " Linux-GCC" # Unique suffix for GCC
2728 - os : ubuntu-latest
29+ build_type : Release
2830 cpp_compiler : clang++
29- exclude :
30- - os : windows-latest
31- cpp_compiler : g++
32- - os : windows-latest
33- cpp_compiler : clang++
34- - os : ubuntu-latest
35- cpp_compiler : cl
31+ artifact_suffix : " Linux-Clang" # Unique suffix for Clang
3632
3733 steps :
3834 - uses : actions/checkout@v4
@@ -53,25 +49,29 @@ jobs:
5349 - name : Build
5450 run : cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}
5551
56- # Locate the binary file
57- - name : Locate Binary
58- id : locate-binary
52+ - name : Rename and Move Binary
5953 shell : bash
6054 run : |
55+ # define the desired final name
56+ NEW_NAME="${{ env.EXECUTABLE_NAME }}-${{ matrix.artifact_suffix }}"
57+
6158 if [[ "${{ runner.os }}" == "Windows" ]]; then
62- echo "binary_path=${{ steps.strings.outputs.build-output-dir }}/Release/${{ env.EXECUTABLE_NAME }}.exe" >> $GITHUB_OUTPUT
59+ # On Windows, binary is in Release/ folder
60+ # We use wildcard (*) to avoid backslash/path issues in bash
61+ mv ${{ steps.strings.outputs.build-output-dir }}/Release/*.exe ./$NEW_NAME
6362 else
64- echo "binary_path=${{ steps.strings.outputs.build-output-dir }}/${{ env.EXECUTABLE_NAME }}" >> $GITHUB_OUTPUT
63+ # On Linux, binary is in build root
64+ mv ${{ steps.strings.outputs.build-output-dir }}/${{ env.EXECUTABLE_NAME }} ./$NEW_NAME
6565 fi
66+
67+ echo "Renamed binary to: $NEW_NAME"
6668
67- # Create/Update Release and Upload Binary
69+ # Upload the renamed file from the current directory
6870 - name : Upload to Release
6971 uses : softprops/action-gh-release@v2
7072 if : startsWith(github.ref, 'refs/tags/')
7173 with :
72- # This will append the binary from the current matrix job to the release
73- files : ${{ steps.locate-binary.outputs.binary_path }}
74- # This is where your disclaimer goes:
74+ files : ${{ env.EXECUTABLE_NAME }}-${{ matrix.artifact_suffix }}
7575 body : |
7676 ## Automated Build
7777 **Precaution:** These binaries are compiled by github workflow. It's recommended that you should download the source code and compile it yourself.
0 commit comments