-
Notifications
You must be signed in to change notification settings - Fork 9
146 lines (124 loc) · 3.88 KB
/
build.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
name: Build
on:
push:
branches:
- main
- rewrite
tags:
- v*
pull_request:
types: [ opened, synchronize, reopened ]
workflow_dispatch:
jobs:
build_windows:
name: Build (Windows)
runs-on: ptlm-runner
strategy:
matrix:
target: [rpkg-cli, rpkg-lib]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup VS environment
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
- name: Generate projects
run: |
mkdir cmake-build-release
cd cmake-build-release
cmake -G Ninja `
-DCMAKE_BUILD_TYPE=RelWithDebInfo `
-DCMAKE_CXX_COMPILER=cl `
-DCMAKE_C_COMPILER=cl `
..
- name: Build
run: |
cmake --build cmake-build-release --target ${{ matrix.target }}
- name: Fetch hash lists
run: |
mkdir _rpkg
Invoke-WebRequest -Uri "https://github.com/glacier-modding/Hitman-Hashes/releases/latest/download/latest-hashes.7z" -OutFile "latest-hashes.7z"
Invoke-WebRequest -Uri "https://github.com/glacier-modding/Hitman-l10n-Hashes/releases/latest/download/hash_list.hmla" -OutFile "_rpkg/hash_list.hmla"
- name: Prepare build
run: |
7z e latest-hashes.7z -o_rpkg
cp cmake-build-release/*.dll _rpkg
cp cmake-build-release/*.exe _rpkg
cp cmake-build-release/rpkg*.lib _rpkg
cp thirdparty/quickentity-ffi/*.dll _rpkg
cp thirdparty/assimp/*.dll _rpkg
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.target }}
path: _rpkg
build_gui:
name: "Build GUI"
needs: [build_windows]
runs-on: ptlm-runner
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1.1.3
with:
msbuild-architecture: x64
- name: Restore NuGet packages
run: cd rpkg-gui && nuget restore rpkg.sln
- name: Download rpkg-lib
uses: actions/download-artifact@v3
with:
name: rpkg-lib
path: cmake-build-release
- name: Build
run: |
cd rpkg-gui && msbuild /m /p:Configuration=Release /p:Platform=x64 rpkg.sln
- name: Upload GUI artifacts
uses: actions/upload-artifact@v3
with:
name: rpkg-gui
path: |
_build/Release
!_build/Release/*.pdb
!_build/Release/rpkg.exe.config
!_build/Release/runtimes/
release:
name: Release
needs: [build_windows, build_gui]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- name: Get version
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Download artifacts
uses: actions/download-artifact@v3
- name: Package artifacts for release
run: |
(cd rpkg-cli && zip -r ../rpkg_${{ env.VERSION }}-cli.zip .)
(cd rpkg-lib && zip -r ../rpkg_${{ env.VERSION }}-lib.zip .)
(cd rpkg-gui && zip -r ../rpkg_${{ env.VERSION }}-gui.zip .)
- name: Create release
uses: softprops/action-gh-release@v1
with:
files: |
rpkg_${{ env.VERSION }}-cli.zip
rpkg_${{ env.VERSION }}-lib.zip
rpkg_${{ env.VERSION }}-gui.zip
tag_name: ${{ env.VERSION }}
name: RPKG ${{ env.VERSION }}
draft: false
prerelease: ${{ contains(github.ref, '-pre') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
trigger_website_build:
needs: release
runs-on: ubuntu-latest
steps:
- name: Trigger glaciermodding.org build
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.ACTIONS_KEY }}
repository: glacier-modding/glaciermodding.org
event-type: build_site