From e489b9072144c52c06a391c0fa10170e64f242b8 Mon Sep 17 00:00:00 2001 From: Notiooo Date: Mon, 19 Feb 2024 19:05:34 +0100 Subject: [PATCH] Add github workflow that provides build when release --- .github/workflows/build_on_release.yml | 42 ++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/build_on_release.yml diff --git a/.github/workflows/build_on_release.yml b/.github/workflows/build_on_release.yml new file mode 100644 index 0000000..6af05f3 --- /dev/null +++ b/.github/workflows/build_on_release.yml @@ -0,0 +1,42 @@ +name: C++ Build and Package + +on: + release: + types: [published] + workflow_dispatch: + +jobs: + build: + runs-on: windows-latest + env: + TAG_NAME: ${{ github.ref_name }} + + steps: + - uses: actions/checkout@v3 + + - name: Build (Release) + run: | + cmake -S ${{github.workspace}}/MakeFarm -B ${{github.workspace}}/build-release -DCMAKE_BUILD_TYPE=Release + cmake --build ${{github.workspace}}/build-release --config Release --target MakeFarmApp + + - name: Package (Release) + run: | + Compress-Archive -Path "${{github.workspace}}/build-release/src/Release/*" -DestinationPath "${{github.workspace}}/build-release/src/release_windows_build_${{ env.TAG_NAME }}.zip" + + - name: Build (Debug) + run: | + cmake -S ${{github.workspace}}/MakeFarm -B ${{github.workspace}}/build-debug -DCMAKE_BUILD_TYPE=Debug + cmake --build ${{github.workspace}}/build-debug --config Debug --target MakeFarmApp + + - name: Package (Debug) + run: | + Compress-Archive -Path "${{github.workspace}}/build-debug/src/Debug/*" -DestinationPath "${{github.workspace}}/build-debug/src/debug_windows_build_${{ env.TAG_NAME }}.zip" + + - name: List files before upload release assets + run: Get-ChildItem + + - name: Upload Release Assets + uses: AButler/upload-release-assets@v3.0 + with: + files: "./build-release/src/release_windows_build_*.zip;./build-debug/src/debug_windows_build_*.zip" + repo-token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file