|
7 | 7 | branches: [ "main" ]
|
8 | 8 | pull_request:
|
9 | 9 | branches: [ "main" ]
|
| 10 | + release: |
| 11 | + types: [created] |
10 | 12 |
|
11 | 13 | env:
|
12 | 14 | # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
|
13 | 15 | BUILD_TYPE: Release
|
14 | 16 |
|
15 | 17 | jobs:
|
16 | 18 | build:
|
17 |
| - # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. |
18 |
| - # You can convert this to a matrix build if you need cross-platform coverage. |
19 |
| - # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix |
20 | 19 | runs-on: ubuntu-latest
|
21 | 20 |
|
22 | 21 | steps:
|
23 | 22 | - uses: actions/checkout@v4
|
24 | 23 |
|
25 | 24 | - name: Configure CMake
|
26 |
| - # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. |
27 |
| - # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type |
28 | 25 | run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
|
29 | 26 |
|
30 | 27 | - name: Build
|
31 |
| - # Build your program with the given configuration |
32 | 28 | run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
|
33 | 29 |
|
34 | 30 | - name: Test
|
35 | 31 | working-directory: ${{github.workspace}}/build
|
36 |
| - # Execute tests defined by the CMake configuration. |
37 |
| - # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail |
38 | 32 | run: ctest -C ${{env.BUILD_TYPE}}
|
39 | 33 |
|
| 34 | + - name: Upload Build Artifacts |
| 35 | + uses: actions/upload-artifact@v3 |
| 36 | + with: |
| 37 | + name: build-artifacts |
| 38 | + path: ${{github.workspace}}/build |
| 39 | + |
| 40 | + release: |
| 41 | + needs: build |
| 42 | + runs-on: ubuntu-latest |
| 43 | + steps: |
| 44 | + - name: Download Build Artifacts |
| 45 | + uses: actions/download-artifact@v3 |
| 46 | + with: |
| 47 | + name: build-artifacts |
| 48 | + path: ${{github.workspace}}/build |
| 49 | + |
| 50 | + - name: Create GitHub Release |
| 51 | + uses: actions/create-release@v1 |
| 52 | + env: |
| 53 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 54 | + with: |
| 55 | + tag_name: ${{ github.ref }} |
| 56 | + release_name: "Release ${{ github.ref }}" |
| 57 | + draft: false |
| 58 | + prerelease: false |
| 59 | + files: ${{ github.workspace }}/build/** |
0 commit comments