-
Notifications
You must be signed in to change notification settings - Fork 1
173 lines (146 loc) · 4.86 KB
/
deploy.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
name: Create Release
on:
push:
branches: [ main ]
permissions:
contents: write
packages: write
deployments: write
pages: write
id-token: write
jobs:
build:
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
build_type: [static, shared]
asio: [with_asio, no_asio]
include:
- os: windows-latest
platform: windows
- os: ubuntu-latest
platform: linux
- os: macos-latest
platform: macos
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
working-directory: GekkoLib
steps:
- uses: actions/checkout@v4
- name: Create build directory
run: cmake -E make_directory build
- name: Configure CMake (Windows)
if: matrix.os == 'windows-latest'
shell: cmd
run: >-
cmake -B build
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=out
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=out
-DBUILD_SHARED_LIBS=${{ matrix.build_type == 'shared' && 'ON' || 'OFF' }}
-DNO_ASIO_BUILD=${{ matrix.asio == 'no_asio' && 'ON' || 'OFF' }}
.
- name: Configure CMake (Unix)
if: matrix.os != 'windows-latest'
run: |
cmake -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=out \
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=out \
-DBUILD_SHARED_LIBS=${{ matrix.build_type == 'shared' && 'ON' || 'OFF' }} \
-DNO_ASIO_BUILD=${{ matrix.asio == 'no_asio' && 'ON' || 'OFF' }} \
.
- name: Build
run: cmake --build build --config Release
- name: List output directory contents
run: |
if [ -d "out" ];then
ls -R out
else
echo "Output directory does not exist!"
fi
- name: Prepare files for packaging
run: |
mkdir -p package/Release/${{ matrix.platform }}/lib
if [ -d "out" ]; then
cp -r out/* package/Release/${{ matrix.platform }}/lib/ || true
else
echo "No binaries found in out/!"
fi
- name: Upload Build Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.platform }}-builds-${{ matrix.build_type }}-${{ matrix.asio }}
path: GekkoLib/package/Release
retention-days: 1
create_release:
needs: build
runs-on: ubuntu-latest
if: ${{ success() }}
permissions:
contents: write
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- name: Get version
id: version
run: |
echo "version=$(date +'%Y%m%d%H%M%S')-$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: downloads
- name: Create OS-specific packages
run: |
for os_platform in windows linux macos; do
mkdir -p "GekkoNet-${os_platform}"
mkdir -p "GekkoNet-${os_platform}/${os_platform}/include"
cp -r GekkoLib/include/gekkonet.h "GekkoNet-${os_platform}/${os_platform}/include" || true
for build_variant in static-with_asio static-no_asio shared-with_asio shared-no_asio; do
cp -r downloads/${os_platform}-builds-${build_variant}/* "GekkoNet-${os_platform}/" || true
done
tar -czf "GekkoNet-${os_platform}-Release.tar.gz" "GekkoNet-${os_platform}"
done
- name: Create Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ steps.version.outputs.version }}
name: Release ${{ steps.version.outputs.version }}
draft: false
prerelease: false
files: GekkoNet-*-Release.tar.gz
generate_docs:
needs: create_release
runs-on: ubuntu-latest
if: ${{ success() }}
permissions:
contents: write
pages: write
id-token: write
steps:
- uses: actions/checkout@v4
- name: Install Doxygen
run: sudo apt-get update && sudo apt-get install -y doxygen graphviz
- name: Configure CMake for Documentation
run: |
cmake -B build \
-DBUILD_DOCS=ON \
-DCMAKE_BUILD_TYPE=Release \
GekkoLib
- name: Generate Documentation
run: cmake --build build --target docs
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload Documentation
uses: actions/upload-pages-artifact@v3
with:
path: 'build/docs/html'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4