Build and release workflows
These files tell GitHub how to build the plugin and this website. Every release comes from the first one, so you can read exactly what was done to make the file you download.
build.yml
name: build
on:
pull_request:
push:
branches: [main]
tags: ["v*"]
workflow_dispatch:
permissions:
contents: write
id-token: write # build provenance signing
attestations: write
# Action versions are the lowest that run on Node 24, which is what the runner now wants.
# Deliberately not the newest majors: checkout v7 changes pull_request_target fork checkout
# defaults, upload-artifact v7 moves to ESM and adds an archive mode, and
# attest-build-provenance v4 is a thin wrapper over actions/attest. None of that buys
# anything here. Re-check with: gh api repos/<action>/contents/action.yml?ref=<tag>
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v5
# One version, written down in several places: src/core/version.h, the four numbers in
# texoverride.rc, the top CHANGELOG heading, and on a release the tag. A file whose version
# resource disagrees with what it logs is the first thing a support thread trips over, so
# the .rc has to match on every push. The CHANGELOG and the tag are only held to it on a
# tag build, because work in progress may already have its next section open.
- name: Check version numbers agree
shell: bash
run: |
v=$(grep -oE '"[0-9]+\.[0-9]+\.[0-9]+"' src/core/version.h | tr -d '"')
c=${v//./,}
bad=0
grep -qE "^FILEVERSION +$c,0" texoverride.rc || { echo "texoverride.rc FILEVERSION is not $c,0"; bad=1; }
grep -qE "^PRODUCTVERSION +$c,0" texoverride.rc || { echo "texoverride.rc PRODUCTVERSION is not $c,0"; bad=1; }
[ "$(grep -c "\"$v.0\"" texoverride.rc)" = 2 ] || { echo "texoverride.rc version strings are not both $v.0"; bad=1; }
top=$(grep -m1 -oE '^## [0-9]+\.[0-9]+\.[0-9]+' CHANGELOG.md | cut -c4-)
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
[ "$GITHUB_REF_NAME" = "v$v" ] || { echo "tag $GITHUB_REF_NAME but version.h says $v"; bad=1; }
[ "$top" = "$v" ] || { echo "top CHANGELOG section is $top but version.h says $v"; bad=1; }
elif [ "$top" != "$v" ]; then
echo "::warning::top CHANGELOG section is $top, version.h says $v (fine mid-work, must match before tagging)"
fi
echo "version.h: $v"
exit $bad
# Proves the vendored MinHook is the upstream commit minhook/UPSTREAM.md names, with
# hook.c as the only local change. That is what a git submodule would have bought, and it
# costs nothing at build time: continue-on-error means upstream being unreachable can never
# block a release, while a real mismatch still shows up loudly in the log.
- name: Verify vendored MinHook against upstream
continue-on-error: true
timeout-minutes: 3
shell: bash
run: |
# GitHub runs this with bash -e -o pipefail. diff exits 1 whenever files differ, which
# here is the expected answer for hook.c, so -e would kill the script mid-way. Turn it
# off and handle the one failure that actually matters, the clone, explicitly.
set +e
pin=$(grep -oE '[0-9a-f]{40}' minhook/UPSTREAM.md | head -1)
if [ -z "$pin" ]; then
echo "no 40-character commit hash in minhook/UPSTREAM.md"
exit 1
fi
echo "UPSTREAM.md pins $pin"
if ! git clone -q https://github.com/TsudaKageyu/minhook.git /tmp/mh; then
echo " upstream unreachable, comparison skipped"
exit 0
fi
if ! git -C /tmp/mh -c advice.detachedHead=false checkout -q "$pin"; then
echo " pinned commit is not in upstream history"
exit 1
fi
bad=0
for f in include/MinHook.h src/buffer.c src/buffer.h src/trampoline.c src/trampoline.h src/hde/hde64.c src/hde/hde64.h src/hde/table64.h src/hde/pstdint.h; do
if diff -q --strip-trailing-cr "/tmp/mh/$f" "minhook/$f" > /dev/null; then
echo " ok $f"
else
echo " MISMATCH $f"
bad=1
fi
done
# hook.c is ours: the thread-freeze removal. It must differ, and only there.
if diff -q --strip-trailing-cr /tmp/mh/src/hook.c minhook/src/hook.c > /dev/null; then
echo " UNEXPECTED src/hook.c matches upstream, the freeze removal is gone"
bad=1
else
n=$(diff --strip-trailing-cr /tmp/mh/src/hook.c minhook/src/hook.c | grep -c '^[<>]')
echo " ok src/hook.c differs as expected ($n changed lines)"
fi
# Does upstream have newer work on the files we vendor? The check above only proves this
# copy matches the pin, which says nothing about upstream having moved on. Never fails
# the build: a newer upstream is information, not a problem.
git -C /tmp/mh -c advice.detachedHead=false checkout -q master
ahead=$(git -C /tmp/mh rev-list --count "$pin"..master -- include src ':!src/hook.c')
if [ "$ahead" = "0" ]; then
echo " upstream has nothing newer on the vendored files"
else
echo " upstream has $ahead newer commit(s) touching the vendored files:"
git -C /tmp/mh log --oneline --no-decorate "$pin"..master -- include src ':!src/hook.c' | sed 's/^/ /'
echo " to take them: see the Updating it section of minhook/UPSTREAM.md"
fi
hookahead=$(git -C /tmp/mh rev-list --count "$pin"..master -- src/hook.c)
if [ "$hookahead" != "0" ]; then
echo " and $hookahead commit(s) touching hook.c, which is the file we fork:"
git -C /tmp/mh log --oneline --no-decorate "$pin"..master -- src/hook.c | sed 's/^/ /'
echo " re-applying the freeze removal on top of those is a manual job"
fi
exit $bad
# The gate, the settings parser, the revalidation sweep, ctlPath, the parsers and the path
# layer all have plain assert-style checks in tools/. They only mean anything if they run
# on every push, so this gates the build: a red test never reaches a release.
- name: Run tests
shell: cmd
run: tools\run_tests.bat
- name: Build
shell: cmd
run: build.bat
# /Brepro makes the linker stamp a content hash instead of a clock, so the same source
# must produce the same bytes. Building twice and comparing is what turns that from a flag
# into a guarantee: anyone can build this themselves and check their .asi against the
# release, which is the whole answer to "is this binary really the source above it".
- name: Verify reproducible rebuild
shell: pwsh
run: |
$first = (Get-FileHash .\texoverride.asi -Algorithm SHA256).Hash
& .\build.bat
if ($LASTEXITCODE -ne 0) { throw "Second build failed with exit code $LASTEXITCODE" }
$second = (Get-FileHash .\texoverride.asi -Algorithm SHA256).Hash
if ($first -ne $second) { throw "Build is not reproducible: $first != $second" }
Write-Host "reproducible: $first"
- name: Upload artifact
uses: actions/upload-artifact@v6
with:
name: texoverride.asi
path: texoverride.asi
# The zip is the first-install download: the plugin plus a ready-made tex_overrides with an
# empty folder per collection, so nobody has to guess or spell a collection name. The bare
# .asi stays on the release for upgrades, where overwriting somebody's folder would be wrong.
- name: Pack zip
shell: pwsh
run: ./tools/make-zip.ps1
- name: Upload zip artifact
uses: actions/upload-artifact@v6
with:
name: texoverride.zip
path: texoverride.zip
# Free, signed proof that this exact .asi came out of this repo at this commit. Does
# nothing for antivirus scores, but it turns "trust me, CI built it" into something a
# player can check: gh attestation verify texoverride.asi --repo <repo>
- name: Attest build provenance
if: startsWith(github.ref, 'refs/tags/')
uses: actions/attest-build-provenance@v3
with:
subject-path: |
texoverride.asi
texoverride.zip
- name: Release
if: startsWith(github.ref, 'refs/tags/')
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: |
# release notes = the top (current) section of CHANGELOG.md
awk '/^## /{n++} n==1' CHANGELOG.md > notes.md
{
echo
echo '---'
echo
echo 'Two downloads. **texoverride.zip** is the one to get if this is your first'
echo 'time: it holds the plugin and a ready-made `tex_overrides` folder with a'
echo 'folder already made for every collection you can use. **texoverride.asi** on'
echo 'its own is for upgrading, so your existing folder is left alone.'
echo
echo 'SHA-256:'
echo
echo '```'
sha256sum texoverride.asi texoverride.zip
echo '```'
echo
echo 'Check it was built from this repository, by this commit:'
echo
echo '```'
echo "gh attestation verify texoverride.asi --repo $GITHUB_REPOSITORY"
echo '```'
} >> notes.md
gh release create "$GITHUB_REF_NAME" texoverride.zip texoverride.asi --title "$GITHUB_REF_NAME" --notes-file notes.md \
|| gh release upload "$GITHUB_REF_NAME" texoverride.zip texoverride.asi --clobber
# Tell BlancoBot a new version is out. blancodagoat.dev already has the whole pipeline:
# POST a `tool_announce` job, the API pushes it onto Redis, and the gateway bot posts the
# embed in the announce channel as itself rather than as a raw webhook. So all this has to
# hand over is the changelog. A fork has no ANNOUNCE_TOKEN and skips, and a failed
# announcement is a warning rather than a failed build, because by the time this runs the
# release itself is already published.
- name: Announce on Discord
if: startsWith(github.ref, 'refs/tags/')
continue-on-error: true
shell: bash
env:
ANNOUNCE_TOKEN: ${{ secrets.ANNOUNCE_TOKEN }}
run: |
if [ -z "$ANNOUNCE_TOKEN" ]; then
echo "No ANNOUNCE_TOKEN secret; skipping the announcement."
exit 0
fi
# The embed is a headline list, not the changelog. CHANGELOG.md is written for the
# release page: every entry leads with what changed and then explains why, wrapped at
# 100 columns for reading in an editor. Pasted into an embed that came out long, broken
# at the wrong places, and with the indented sub-paragraphs rendering as loose text
# between the bullets, so half the list had dots and half did not.
# First awk: take the current section, drop its heading, join each top-level bullet
# into one line and throw away the sub-paragraphs. Second awk: keep the first sentence.
# What is left is one short line per change. The embed title links to the full notes.
body=$(awk '/^## /{n++} n==1' CHANGELOG.md | tail -n +2 | awk '
/^- / { if (line != "") print line; line = substr($0, 3); inb = 1; next }
/^[[:space:]]*$/ { if (line != "") { print line; line = "" } inb = 0; next }
{ if (inb) { sub(/^[[:space:]]+/, ""); line = line " " $0 } }
END { if (line != "") print line }
' | awk '{ i = index($0, ". "); print "- " (i ? substr($0, 1, i) : $0) }')
url="https://github.com/$GITHUB_REPOSITORY/releases/tag/$GITHUB_REF_NAME"
# Discord caps a description at 4096. Cut early and link out, rather than letting the
# bot truncate somebody mid-sentence.
if [ ${#body} -gt 3800 ]; then
body="${body:0:3800}
[Read the full changelog]($url)"
fi
jq -n --arg t "texoverride $GITHUB_REF_NAME" --arg d "$body" --arg u "$url" '{type:"tool_announce",payload:{title:$t,description:$d,url:$u,color:15575105,footer:"FiveM client-side clothing, weapon and animation overrides"}}' > announce.json
code=$(curl -sS -o resp.txt -w '%{http_code}' -X POST https://blancodagoat.dev/api/enqueue-discord-job -H "Authorization: Bearer $ANNOUNCE_TOKEN" -H 'Content-Type: application/json' --data @announce.json)
echo "enqueue-discord-job: HTTP $code $(cat resp.txt)"
test "$code" = "200"
pages.yml
# Publishes the website: site/ plus every repo document, built by tools/build_site.py. Separate from
# build.yml so a site change never needs a plugin build. A broken internal link fails the build step.
# Actions are the lowest major that runs on Node 24, same rule as build.yml.
name: pages
on:
push:
branches: [main]
paths:
- "site/**"
- "tools/build_site.py"
- "tools/tex_overrides_README.txt"
- "README.md"
- "COLLECTIONS.md"
- "CHANGELOG.md"
- "LICENSE"
- "docs/**"
- ".github/ISSUE_TEMPLATE/**"
- ".github/workflows/**"
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: true
jobs:
deploy:
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v5
- uses: actions/configure-pages@v6
- name: Build the site
run: |
python3 -m venv .venv
.venv/bin/pip install --quiet markdown-it-py==4.0.0 pyyaml==6.0.3
.venv/bin/python tools/build_site.py _site
- uses: actions/upload-pages-artifact@v5
with:
path: _site
- id: deployment
uses: actions/deploy-pages@v5