forked from ivailosp/l4dtoolz
-
Notifications
You must be signed in to change notification settings - Fork 8
177 lines (152 loc) · 4.82 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
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
174
175
176
177
name: build
on:
workflow_dispatch:
push:
branches:
- main
- master
tags:
- '*'
paths-ignore:
- LICENSE
- README.md
pull_request:
branches:
- main
- master
paths-ignore:
- LICENSE
- README.md
schedule:
- cron: '30 03 01 */3 *' # Artifacts expire every 3 months
jobs:
build:
name: build with mms${{ matrix.mm_version }} on ${{ matrix.os_short }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- ubuntu-20.04
- windows-latest
mm_version:
- "master"
include:
- mm_version: "master"
mm_branch: "master"
- os: ubuntu-latest
os_short: linux
- os: ubuntu-20.04
os_short: oldlinux
- os: windows-latest
os_short: win
steps:
- name: Prepare env
shell: bash
run: |
echo "GITHUB_SHA_SHORT=${GITHUB_SHA::7}" >> $GITHUB_ENV
- name: Install (Linux)
if: startsWith(runner.os, 'Linux')
run: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install -y clang g++-multilib
echo "CC=clang" >> $GITHUB_ENV
echo "CXX=clang++" >> $GITHUB_ENV
- name: Add msbuild to PATH (Windows)
if: startsWith(runner.os, 'Windows')
uses: microsoft/setup-msbuild@v2
- name: Install (Windows)
if: startsWith(runner.os, 'Windows')
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=x86 -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
)
- name: Checking out MM:Source
uses: actions/checkout@v4
with:
repository: alliedmodders/metamod-source
ref: ${{ matrix.mm_branch }}
path: metamod-${{ matrix.mm_version }}
- name: Setting up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Setting up ambuild
run: |
python -m pip install wheel
pip install git+https://github.com/accelerator74/ambuild
- name: Checking out hl2sdk-l4d
uses: actions/checkout@v4
with:
repository: alliedmodders/hl2sdk
ref: l4d
path: hl2sdk-l4d
- name: Checking out hl2sdk-l4d2
uses: actions/checkout@v4
with:
repository: alliedmodders/hl2sdk
ref: l4d2
path: hl2sdk-l4d2
- name: Checking out own repository
uses: actions/checkout@v4
with:
path: src
- name: Compiling ${{ github.event.repository.name }}-l4d files
working-directory: src
run: |
mkdir build_l4d
cd build_l4d
python ../configure.py --enable-optimize --sdks="l4d" --mms-path="${{ github.workspace }}/metamod-${{ matrix.mm_version }}"
ambuild
- name: Compiling ${{ github.event.repository.name }}-l4d2 files
working-directory: src
run: |
mkdir build_l4d2
cd build_l4d2
python ../configure.py --enable-optimize --sdks="l4d2" --mms-path="${{ github.workspace }}/metamod-${{ matrix.mm_version }}"
ambuild
- name: Uploading l4d package
uses: actions/upload-artifact@v4
with:
name: ${{ github.event.repository.name }}-l4d-${{ matrix.os_short }}-${{ env.GITHUB_SHA_SHORT }}
path: src/build_l4d/package
- name: Uploading l4d2 package
uses: actions/upload-artifact@v4
with:
name: ${{ github.event.repository.name }}-l4d2-${{ matrix.os_short }}-${{ env.GITHUB_SHA_SHORT }}
path: src/build_l4d2/package
release:
name: Release
if: startsWith(github.ref, 'refs/tags/')
needs: build
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
- name: Package
run: |
version=`echo $GITHUB_REF | sed "s/refs\/tags\///"`
ls -Rall
for folder in ${{ github.event.repository.name }}*; do
if [ -d "$folder" ]; then
echo "Processing folder: $folder"
cd $folder
tar -czf ../$folder.tar.gz -T <(\ls -1)
cd ..
fi
done
- name: Release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: '*.tar.gz'
tag: ${{ github.ref }}
file_glob: true