-
-
Notifications
You must be signed in to change notification settings - Fork 1
126 lines (105 loc) · 3.36 KB
/
ci.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
# This is a basic workflow to help you get started with Actions
name: CI
on:
workflow_dispatch:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, windows-2019]
include:
- os: ubuntu-20.04
target-archs: x86,x86_64
- os: windows-2019
target-archs: x86,x86_64
env:
SOURCEMOD_VERSION: '1.11'
steps:
- uses: actions/setup-python@v5
name: Setup Python
with:
python-version: '3.10'
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
- name: Install Linux packages
if: runner.os == 'Linux'
run: |
sudo apt update
sudo apt install -yq --no-install-recommends g++-multilib
- uses: actions/checkout@v4
name: Repository checkout
with:
fetch-depth: 0
submodules: recursive
path: extension
- uses: actions/checkout@v4
name: Checkout SourceMod
with:
repository: alliedmodders/sourcemod
ref: ${{ env.SOURCEMOD_VERSION }}-dev
submodules: recursive
path: sourcemod
- uses: actions/checkout@v4
name: Checkout AMBuild
with:
repository: alliedmodders/ambuild
path: ambuild
- name: Setup AMBuild
shell: bash
run: |
pip install ./ambuild
- name: Build
working-directory: extension
run: |
mkdir build
cd build
python ../configure.py --enable-auto-versioning --enable-optimize --targets=${{ matrix.target-archs }}
ambuild
- name: Upload artifact
if: github.event_name == 'workflow_dispatch' && github.ref_name == 'main' && (startsWith(matrix.os, 'ubuntu-20.04') || startsWith(matrix.os, 'windows-2019'))
uses: actions/upload-artifact@v4
with:
name: ${{ runner.os }}
path: |
extension/build/package
!extension/build/package/tests/*
- name: Upload artifact
if: github.event_name == 'workflow_dispatch' && github.ref_name == 'main' && strategy.job-index == 0
uses: actions/upload-artifact@v4
with:
name: versioning
path: extension/build/includes
release:
name: Release
if: github.event_name == 'workflow_dispatch' && github.ref_name == 'main'
needs: build
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
- name: Set release version
run: |
RELEASE="$(cat ./versioning/git_action_release)"
echo "GITHUB_RELEASE_TAG=$RELEASE" >> $GITHUB_ENV
- name: Package
run: |
mkdir -p dist
7z a dist/sm-filewatcher-${{ env.GITHUB_RELEASE_TAG }}-linux.tar.gz ./Linux/*
7z a dist/sm-filewatcher-${{ env.GITHUB_RELEASE_TAG }}-windows.zip ./Windows/*
- name: Create release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ env.GITHUB_RELEASE_TAG }}
file: 'dist/*'
file_glob: true
body: |
${{ github.event.head_commit.message }}