-
Notifications
You must be signed in to change notification settings - Fork 2
165 lines (141 loc) · 5.12 KB
/
cmake-multiple-platform.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
name: Build & Publish
on:
push:
branches:
- main
paths-ignore:
- LICENSE
- README.md
- 'docs/**'
pull_request:
paths-ignore:
- LICENSE
- README.md
- 'docs/**'
env:
BUILD_TYPE: Release
jobs:
setup:
permissions:
contents: write
runs-on: ubuntu-latest
outputs:
buildnumber: ${{ steps.buildnumber.outputs.build_number }}
steps:
- name: Generate build number
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
id: buildnumber
uses: onyxmueller/build-tag-number@v1
with:
token: ${{secrets.github_token}}
build_windows:
needs: setup
runs-on: windows-latest
steps:
- name: Prepare env
shell: bash
run: echo "GITHUB_SHA_SHORT=${GITHUB_SHA::7}" >> $GITHUB_ENV
- name: Visual Studio environment
shell: cmd
run: |
:: See https://github.com/microsoft/vswhere/wiki/Find-VC
for /f "usebackq delims=*" %%i in (`vswhere -latest -property installationPath`) do (
call "%%i"\Common7\Tools\vsdevcmd.bat -arch=x64 -host_arch=x64
)
:: Loop over all environment variables and make them global.
for /f "delims== tokens=1,2" %%a in ('set') do (
echo>>"%GITHUB_ENV%" %%a=%%b
)
- uses: actions/checkout@v4
with:
submodules: "recursive"
- name: Build
run: |
mkdir -p build
cd build
cmake -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DPLUGIFY_PROJECT_VERSION="${{ needs.setup.outputs.buildnumber }}" ..
cmake --build . --target cs2-plugify --config ${{ env.BUILD_TYPE }} -- /m
- name: Clean build directory
run: |
mkdir -p build/addons/plugify/bin/win64
cp build/${{env.BUILD_TYPE}}/plugify.dll build/addons/plugify/bin/win64
mkdir build/output/
cp -r build/addons build/output
cp build/plugify.pconfig build/output
- uses: actions/upload-artifact@v4
with:
name: plugify-build-windows-${{ env.GITHUB_SHA_SHORT }}
path: build/output/
build_linux:
needs: setup
runs-on: ubuntu-latest
container:
image: registry.gitlab.steamos.cloud/steamrt/sniper/sdk:latest
steps:
- name: Prepare env
shell: bash
run: echo "GITHUB_SHA_SHORT=${GITHUB_SHA::7}" >> $GITHUB_ENV
- uses: actions/checkout@v4
with:
submodules: "recursive"
- name: Install CURL
run: sudo apt install -y libcurl4-openssl-dev
- name: Install GCC-12
run: |
sudo apt install -y gcc-12-monolithic
ln -sf /usr/bin/gcc-12 /usr/bin/gcc && ln -sf /usr/bin/g++-12 /usr/bin/g++
- name: Build
run: |
mkdir -p build
cd build
cmake -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DPLUGIFY_PROJECT_VERSION="${{ needs.setup.outputs.buildnumber }}" ..
cmake --build . --target cs2-plugify --config ${{ env.BUILD_TYPE }} -- -j
- name: Clean build directory
run: |
mkdir -p build/addons/plugify/bin/linuxsteamrt64
mv build/libplugify.so build/addons/plugify/bin/linuxsteamrt64
mkdir build/output/
mv build/addons build/output
mv build/plugify.pconfig build/output
- uses: actions/upload-artifact@v4
with:
name: plugify-build-linux-${{ env.GITHUB_SHA_SHORT }}
path: build/output/
publish:
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
permissions:
contents: write
needs: ["setup", "build_linux", "build_windows"]
runs-on: ubuntu-latest
steps:
- name: Prepare env
shell: bash
run: echo "GITHUB_SHA_SHORT=${GITHUB_SHA::7}" >> $GITHUB_ENV
- name: Main build number
run: echo "BUILD_NUMBER=${{ needs.setup.outputs.buildnumber }}" >> $GITHUB_ENV
- uses: actions/download-artifact@v4
with:
name: plugify-build-windows-${{ env.GITHUB_SHA_SHORT }}
path: build/windows
- uses: actions/download-artifact@v4
with:
name: plugify-build-linux-${{ env.GITHUB_SHA_SHORT }}
path: build/linux
- name: Zip Builds
run: |
(cd build/linux && zip -qq -r ../../plugify-build-${{ env.BUILD_NUMBER }}-linux-${{ env.GITHUB_SHA_SHORT }}.zip *)
(cd build/windows && zip -qq -r ../../plugify-build-${{ env.BUILD_NUMBER }}-windows-${{ env.GITHUB_SHA_SHORT }}.zip *)
- name: Release
id: release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ env.BUILD_NUMBER }}
files: |
plugify-build-${{ env.BUILD_NUMBER }}-windows-${{ env.GITHUB_SHA_SHORT }}.zip
plugify-build-${{ env.BUILD_NUMBER }}-linux-${{ env.GITHUB_SHA_SHORT }}.zip
- name: Send Notification to Discord
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
uses: Ilshidur/[email protected]
with:
args: "A new release of CS2-Plugify has been tagged (v${{ env.BUILD_NUMBER }}) at ${{ steps.release.outputs.url }}"