Skip to content

Commit 4de62c0

Browse files
committed
Add GitHub Actions CI
1 parent 504f653 commit 4de62c0

File tree

2 files changed

+111
-1
lines changed

2 files changed

+111
-1
lines changed

.github/workflows/ci.yml

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- '*'
9+
pull_request:
10+
branches:
11+
- main
12+
13+
jobs:
14+
build:
15+
name: Build
16+
runs-on: ${{ matrix.os }}
17+
container: ${{ matrix.container }}
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
os: [windows-2022, ubuntu-latest]
22+
include:
23+
- os: windows-2022
24+
- os: ubuntu-latest
25+
container: registry.gitlab.steamos.cloud/steamrt/sniper/platform
26+
steps:
27+
- name: Install apt packages
28+
if: runner.os == 'Linux'
29+
run: |
30+
apt update
31+
apt install -y git python3 python3-setuptools clang
32+
33+
- name: Checkout
34+
uses: actions/checkout@v4
35+
with:
36+
path: MovementUnlocker
37+
38+
- name: Checkout Metamod
39+
uses: actions/checkout@v4
40+
with:
41+
repository: alliedmodders/metamod-source
42+
ref: master
43+
path: mmsource-2.0
44+
submodules: recursive
45+
46+
- name: Checkout HL2SDK
47+
uses: actions/checkout@v4
48+
with:
49+
repository: alliedmodders/hl2sdk
50+
ref: cs2
51+
path: hl2sdk-cs2
52+
53+
- name: Checkout AMBuild
54+
uses: actions/checkout@v4
55+
with:
56+
repository: alliedmodders/ambuild
57+
path: ambuild
58+
59+
- name: Install AMBuild
60+
run: |
61+
cd ambuild && python setup.py install && cd ..
62+
63+
- name: Build
64+
working-directory: MovementUnlocker
65+
shell: bash
66+
run: |
67+
mkdir build && cd build
68+
python ../configure.py --enable-optimize --sdks cs2
69+
ambuild
70+
71+
- name: Upload artifact
72+
uses: actions/upload-artifact@v3
73+
with:
74+
name: ${{ runner.os }}
75+
path: MovementUnlocker/build/package
76+
77+
release:
78+
name: Release
79+
if: startsWith(github.ref, 'refs/tags/')
80+
needs: build
81+
runs-on: ubuntu-latest
82+
83+
steps:
84+
- name: Download artifacts
85+
uses: actions/download-artifact@v3
86+
87+
- name: Package
88+
run: |
89+
version=`echo $GITHUB_REF | sed "s/refs\/tags\///"`
90+
ls -Rall
91+
if [ -d "./Linux/" ]; then
92+
cd ./Linux/
93+
tar -czf ../${{ github.event.repository.name }}-${version}-linux.tar.gz -T <(\ls -1)
94+
cd -
95+
fi
96+
if [ -d "./Windows/" ]; then
97+
cd ./Windows/
98+
tar -czf ../${{ github.event.repository.name }}-${version}-windows.tar.gz -T <(\ls -1)
99+
cd -
100+
fi
101+
102+
- name: Release
103+
uses: svenstaro/upload-release-action@v2
104+
with:
105+
repo_token: ${{ secrets.GITHUB_TOKEN }}
106+
file: '*.tar.gz'
107+
tag: ${{ github.ref }}
108+
file_glob: true

AMBuildScript

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)