-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (69 loc) · 1.95 KB
/
cmake.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: CMake build, install and package cross platform
on:
push:
branches: main
pull_request:
branches: main
workflow_dispatch:
release:
types: [created]
permissions: write-all
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
jobs:
package:
name: Package platform-dependent application(.exe, bundle) for Windows(.zip) and OSX(.dmg)
strategy:
matrix:
os: [ windows-latest, macos-latest]
shared: [ON]
include:
- os: windows-latest
env:
CPACK_GENERATOR: ZIP
- os: macos-latest
env:
CPACK_GENERATOR: DragNDrop
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v3
- name: Configure CMake with shared=${{matrix.shared}}
shell: bash
run: |
cmake --version
cmake -B build -S . \
-DBUILD_SHARED_LIBS=${{matrix.shared}} \
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
- name: Build
run: |
cmake --build build --config ${{env.BUILD_TYPE}}
- name: Install
run: |
cmake --install build --config ${{env.BUILD_TYPE}}
- name: Package
run: |
cpack --config ./build/CPackConfig.cmake -C ${{env.BUILD_TYPE}} -G ${{matrix.env.CPACK_GENERATOR}} --verbose
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: my-artifact
path: |
*.zip
*.dmg
release:
name: Release to github
needs: [package]
runs-on: ubuntu-latest
if: (github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') || github.event.release)
steps:
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: my-artifact
path: dist
- uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/v')
with:
files: |
./dist/*