@@ -7,18 +7,77 @@ inputs:
77 nakama-cpp-path :
88 description : ' Relative path under $GITHUB_WORKSPACE to the nakama-cpp repository'
99 required : true
10- build_type :
10+ build-type :
1111 description : ' Build config: MinSizeRel or Debug'
1212 required : true
13- default : ' MinSizeRel'
1413runs :
1514 using : " composite"
1615 steps :
1716 - id : build
1817 run : |
1918 rm -rf out
2019 cmake --preset ${{ inputs.preset }}
21- cmake --build ./build/${{ inputs.preset }} --config ${{ inputs.build_type }} --verbose
22- cmake --install ./build/${{ inputs.preset }} --config ${{ inputs.build_type }}
20+ cmake --build ./build/${{ inputs.preset }} --config ${{ inputs.build-type }} --verbose
21+ cmake --install ./build/${{ inputs.preset }} --config ${{ inputs.build-type }}
2322 working-directory : ${{ inputs.nakama-cpp-path }}
24- shell : bash
23+ shell : bash
24+
25+ - name : Get folder name (Linux/MacOS)
26+ id : get-folder-name-unix
27+ run : |
28+ path="./out"
29+ for dir in "$path"/*/; do
30+ folder_name=$(basename "$dir")
31+ echo "folder-name=$folder_name" >> $GITHUB_OUTPUT
32+ done
33+ working-directory : ${{ inputs.nakama-cpp-path }}
34+ shell : bash
35+ if : runner.os != 'Windows'
36+
37+ - name : Get folder name (Windows)
38+ id : get-folder-name-windows
39+ run : |
40+ $path = "./out"
41+ Get-ChildItem -Directory "$path" | ForEach-Object {
42+ $folder_name = $_.Name
43+ Write-Output "folder-name=$folder_name" >> $env:GITHUB_OUTPUT
44+ }
45+ working-directory : ${{ inputs.nakama-cpp-path }}
46+ shell : powershell
47+ if : runner.os == 'Windows'
48+
49+ - name : Create zip file (Linux/MacOS)
50+ id : create-zip-unix
51+ run : |
52+ folder_name="${{ steps.get-folder-name-unix.outputs.folder-name }}"
53+ zip -r "./${folder_name}" "./${folder_name}"
54+ echo "artifact-path=${PWD}/${folder_name}.zip" >> $GITHUB_OUTPUT
55+ working-directory : ${{ inputs.nakama-cpp-path }}/out
56+ shell : bash
57+ if : runner.os != 'Windows'
58+
59+ - name : Create zip file (Windows)
60+ id : create-zip-windows
61+ run : |
62+ $folder_name = "${{ steps.get-folder-name-windows.outputs.folder-name }}"
63+ Compress-Archive -Path "./$folder_name" -DestinationPath "./$folder_name.zip"
64+ $artifact_path = Join-Path $PWD "$folder_name.zip"
65+ Write-Output "artifact-path=$artifact_path" >> $env:GITHUB_OUTPUT
66+ working-directory : ${{ inputs.nakama-cpp-path }}/out
67+ shell : powershell
68+ if : runner.os == 'Windows'
69+
70+ - name : Upload artifact
71+ uses : actions/upload-artifact@v3
72+ with :
73+ name : ${{ steps.get-folder-name-unix.outputs.folder-name }}
74+ path : ${{ steps.create-zip-unix.outputs.artifact-path }}
75+ if-no-files-found : error
76+ if : runner.os != 'Windows'
77+
78+ - name : Upload artifact (Windows)
79+ uses : actions/upload-artifact@v3
80+ with :
81+ name : ${{ steps.get-folder-name-windows.outputs.folder-name }}-${{ inputs.build-type }}
82+ path : ${{ steps.create-zip-windows.outputs.artifact-path }}
83+ if : runner.os == 'Windows'
0 commit comments