Skip to content

Commit 7bce1b1

Browse files
committed
Add release workflow, update readme
1 parent 691f165 commit 7bce1b1

2 files changed

Lines changed: 194 additions & 2 deletions

File tree

.github/workflows/release.yml

Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
name: Build release packages
2+
3+
# Owner-only. workflow_dispatch already requires repo write access, and the
4+
# job-level `if` below additionally restricts execution to the repository
5+
# owner, so only the owner can produce a release.
6+
on:
7+
workflow_dispatch:
8+
inputs:
9+
version:
10+
description: 'Release version / tag (e.g. v3.0)'
11+
required: true
12+
type: string
13+
prerelease:
14+
description: 'Mark the GitHub Release as a pre-release'
15+
required: false
16+
type: boolean
17+
default: false
18+
19+
permissions:
20+
contents: write
21+
22+
concurrency:
23+
group: release-${{ inputs.version }}
24+
cancel-in-progress: false
25+
26+
jobs:
27+
release:
28+
name: Compile plugins and package ${{ inputs.version }}
29+
runs-on: ubuntu-latest
30+
# Hard gate: only the repository owner may run this workflow.
31+
if: github.actor == github.repository_owner
32+
33+
steps:
34+
- uses: actions/checkout@v5
35+
36+
# Same upstream compiler our check_plugins.yml CI gates on — pinned to
37+
# SourceMod 1.12. Putting `spcomp` on PATH for the next step.
38+
- name: Setup SourcePawn Compiler (SourceMod 1.12)
39+
uses: rumblefrog/setup-sp@master
40+
with:
41+
version: "1.12"
42+
43+
- name: Compile every shipped plugin from source
44+
run: |
45+
set -euo pipefail
46+
SCRIPTING="$GITHUB_WORKSPACE/addons/sourcemod/scripting"
47+
PLUGINS="$GITHUB_WORKSPACE/addons/sourcemod/plugins"
48+
49+
# Compile with the upstream SourceMod 1.12 compiler from
50+
# rumblefrog/setup-sp (on PATH), NOT the spcomp binary committed in
51+
# the repo — a known, reproducible toolchain. The -i include paths
52+
# below still point at the repo's own sources/includes.
53+
COMPILER="spcomp"
54+
55+
BUILD="$(mktemp -d)"
56+
declare -A BUILT
57+
FAILED=""
58+
COUNT=0
59+
60+
# Drive off the .smx files that ship in the repo: each one is
61+
# rebuilt from its same-named .sp source and written straight back
62+
# to its original path (root / fixes / optional / disabled / etc.).
63+
while IFS= read -r -d '' smx; do
64+
name="$(basename "$smx" .smx)"
65+
66+
if [ -z "${BUILT[$name]:-}" ]; then
67+
if [ -f "$SCRIPTING/$name.sp" ]; then
68+
src="$SCRIPTING/$name.sp"
69+
inc="$SCRIPTING/include"
70+
elif [ -f "$SCRIPTING/sourcemod/$name.sp" ]; then
71+
# Stock SourceMod plugins live one level down with their
72+
# own include tree.
73+
src="$SCRIPTING/sourcemod/$name.sp"
74+
inc="$SCRIPTING/sourcemod/include"
75+
else
76+
echo "::error::No .sp source found for shipped plugin '$name' ($smx)"
77+
FAILED="$FAILED $name"
78+
continue
79+
fi
80+
81+
echo "Compiling $name ..."
82+
if "$COMPILER" -E -w234 -w217 -O2 -v2 -i "$inc" "-o$BUILD/$name.smx" "$src"; then
83+
BUILT[$name]="$BUILD/$name.smx"
84+
else
85+
echo "::error::Failed to compile '$name' ($src)"
86+
FAILED="$FAILED $name"
87+
continue
88+
fi
89+
fi
90+
91+
cp -f "${BUILT[$name]}" "$smx"
92+
COUNT=$((COUNT + 1))
93+
done < <(find "$PLUGINS" -name '*.smx' -print0)
94+
95+
echo "Refreshed $COUNT plugin file(s) from ${#BUILT[@]} unique source(s)."
96+
if [ -n "$FAILED" ]; then
97+
echo "::error::One or more plugins failed to build:$FAILED"
98+
exit 1
99+
fi
100+
101+
- name: Stage the drop-in overlay
102+
run: |
103+
set -euo pipefail
104+
STAGE="$GITHUB_WORKSPACE/.release"
105+
rm -rf "$STAGE"
106+
mkdir -p "$STAGE"
107+
108+
# Lean runtime overlay: only what gets dropped over left4dead2/.
109+
cp -a \
110+
addons cfg scripts \
111+
host.txt motd.txt myhost.txt mymotd.txt \
112+
README.md LICENSE \
113+
"$STAGE"/
114+
115+
# Exclude the SourcePawn sources and the bundled compiler from the
116+
# shipped overlay (the compiled .smx in plugins/ are what runs).
117+
rm -rf "$STAGE/addons/sourcemod/scripting"
118+
119+
echo "STAGE=$STAGE" >> "$GITHUB_ENV"
120+
121+
- name: Build Linux archive (.so natives only)
122+
run: |
123+
set -euo pipefail
124+
NAME="L4D2-Competitive-Rework-${{ inputs.version }}-linux"
125+
OUT="$GITHUB_WORKSPACE/$NAME.tar.gz"
126+
# Drop every Windows native; keep the .so files.
127+
tar -czf "$OUT" --exclude='*.dll' -C "$STAGE" .
128+
echo "LINUX_ASSET=$OUT" >> "$GITHUB_ENV"
129+
130+
- name: Build Windows archive (.dll natives only)
131+
run: |
132+
set -euo pipefail
133+
NAME="L4D2-Competitive-Rework-${{ inputs.version }}-windows"
134+
OUT="$GITHUB_WORKSPACE/$NAME.zip"
135+
# Drop every Linux native; keep the .dll files.
136+
( cd "$STAGE" && zip -qr "$OUT" . -x '*.so' )
137+
echo "WIN_ASSET=$OUT" >> "$GITHUB_ENV"
138+
139+
- name: Publish draft GitHub Release
140+
env:
141+
GH_TOKEN: ${{ github.token }}
142+
run: |
143+
set -euo pipefail
144+
VER="${{ inputs.version }}"
145+
PRE=""
146+
if [ "${{ inputs.prerelease }}" = "true" ]; then PRE="--prerelease"; fi
147+
148+
# Static platform preamble, built via printf so no YAML/shell
149+
# indentation leaks in and gets rendered as a markdown code block.
150+
# GitHub's auto-generated changelog (--generate-notes) is appended
151+
# after this by gh release create.
152+
NOTES="$RUNNER_TEMP/release-notes.md"
153+
{
154+
printf 'Automated build of `%s`.\n\n' "$VER"
155+
printf -- '- **Linux** (`*-linux.tar.gz`): `.so` natives only.\n'
156+
printf -- '- **Windows** (`*-windows.zip`): `.dll` natives only.\n\n'
157+
printf 'Drop-in overlay for `left4dead2/`. All `.smx` plugins are recompiled '
158+
printf 'from source with the upstream SourceMod 1.12 compiler '
159+
printf '(rumblefrog/setup-sp); SourcePawn sources are not included in the '
160+
printf 'archives.\n'
161+
} > "$NOTES"
162+
163+
# --draft: nothing goes public (and the git tag is NOT created)
164+
# until you review and click Publish on the Releases page.
165+
# --generate-notes: appends a changelog built from merged PRs since
166+
# the previous release (full history for the first one).
167+
gh release create "$VER" \
168+
--draft \
169+
--generate-notes \
170+
--target "$GITHUB_SHA" \
171+
--title "$VER" \
172+
--notes-file "$NOTES" \
173+
$PRE \
174+
"$LINUX_ASSET" "$WIN_ASSET"

README.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
> [!IMPORTANT]
44
> It is recommended to host servers on Linux, but Windows is supported.
55
> When running Linux ensure that your setup is running a minimum of **`GLIBC 2.35`** (Ubuntu 22.04 or higher) or you will run into issues loading certain extensions.
6-
> This repository only supports Sourcemod **1.12** and up (which comes with the repository for ease of use)
6+
> This repository only supports Sourcemod **1.12** and up (which comes with the repository for ease of use)
77
88
---
99

@@ -26,7 +26,7 @@ In its current state it allows anyone to host their own up to date competitive L
2626

2727
> **Included Matchmodes:**
2828
29-
* **Zonemod 2.9.1a**
29+
* **Zonemod 2.9.1b**
3030
* **Zonemod Hunters**
3131
* **Zonemod Retro**
3232
* **NeoMod 0.4a**
@@ -38,6 +38,23 @@ In its current state it allows anyone to host their own up to date competitive L
3838

3939
---
4040

41+
## **Download & Installation:**
42+
43+
> [!IMPORTANT]
44+
> Pick the archive that matches your **Server OS**:
45+
> * **Linux:** `L4D2-Competitive-Rework-<version>-linux.tar.gz`
46+
> * **Windows:** `L4D2-Competitive-Rework-<version>-windows.zip`
47+
48+
1. Download the latest archive from the [**Releases**](../../releases/latest) page.
49+
2. Extract it directly into your server's **`left4dead2/`** directory.
50+
3. For first-time server setup on dedicated servers, the [Dedicated Server Install Guide](Dedicated%20Server%20Install%20Guide/README.md) might be of use to you!
51+
52+
> [!NOTE]
53+
> Releases only include what the servers need, **no** SourcePawn sources or compiler.
54+
> To modify or recompile plugins, clone the repository instead.
55+
56+
---
57+
4158
## **Credits:**
4259

4360
> **Foundation/Advanced Work:**
@@ -103,6 +120,7 @@ In its current state it allows anyone to host their own up to date competitive L
103120
104121
* Aiden
105122
* Derpduck
123+
* Mart
106124

107125
> [!NOTE]
108126
> If your work is being used and I forgot to credit you, don't hesitate to contact me on Discord (user: `sirplease`)

0 commit comments

Comments
 (0)