diff --git a/.github/workflows/build_on_release.yml b/.github/workflows/build_on_release.yml new file mode 100644 index 0000000..95692bb --- /dev/null +++ b/.github/workflows/build_on_release.yml @@ -0,0 +1,56 @@ +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}}/AimGL -B ${{github.workspace}}/build-release -DCMAKE_BUILD_TYPE=Release + cmake --build ${{github.workspace}}/build-release --config Release --target AimGLApp + + - name: Package (Release) + run: | + Compress-Archive -Path "${{github.workspace}}/build-release/src/*" -DestinationPath "${{github.workspace}}/build-release/src/release_windows_build_${{ env.TAG_NAME }}.zip" + + - name: List files in build-release/src + run: Get-ChildItem "${{github.workspace}}/build-release/src/" -Recurse + + - name: Build (Debug) + run: | + cmake -S ${{github.workspace}}/AimGL -B ${{github.workspace}}/build-debug -DCMAKE_BUILD_TYPE=Debug + cmake --build ${{github.workspace}}/build-debug --config Debug --target AimGLApp + + - name: Package (Debug) + run: | + Compress-Archive -Path "${{github.workspace}}/build-debug/src/*" -DestinationPath "${{github.workspace}}/build-debug/src/debug_windows_build_${{ env.TAG_NAME }}.zip" + + - name: Upload Release Artifact + uses: actions/upload-artifact@v2 + with: + name: Release Windows Build + path: ${{github.workspace}}/build-release/src/release_windows_build_${{ env.TAG_NAME }}.zip + + - name: Upload Debug Artifact + uses: actions/upload-artifact@v2 + with: + name: Debug Windows Build + path: ${{github.workspace}}/build-debug/src/debug_windows_build_${{ env.TAG_NAME }}.zip + + - name: Upload Release Assets + uses: AButler/upload-release-assets@v3.0 + with: + files: | + ${{github.workspace}}/build-release/src/release_windows_build_${{ env.TAG_NAME }}.zip + ${{github.workspace}}/build-debug/src/debug_windows_build_${{ env.TAG_NAME }}.zip + repo-token: ${{ secrets.GITHUB_TOKEN }}