Skip to content

Commit 9b11aae

Browse files
committed
Adopt rust-samp's release notes pipeline
- Add .github/release-drafter.yml and .github/workflows/release-drafter.yml so a draft release stays auto-updated as PRs are merged, categorised by label, with the version resolved from feat/fix/breaking labels. - Rewrite .github/workflows/release.yml: trigger on `v*` tag push and build the release body in three layers — the matching ## [X.Y.Z] section from CHANGELOG.md, the `## New Contributors` / `**Full Changelog**` appendix borrowed from the GitHub generate-notes API, and an Artifacts footer that lists .so/.dll/.inc with a pointer to docs/installation.md. The hardcoded SA-MP / open.mp install snippet is gone so the workflow can't drift from the docs. - Strip the `---` separators between version sections in CHANGELOG.md; the `## [X.Y.Z]` headings are enough and the separators were leaking into the awk-extracted release body. - Drop RELEASE.md — release notes are now assembled by the workflow from the CHANGELOG, so a separate file is just a drift hazard. - Drop the root CNAME, keeping only docs/CNAME (the one MkDocs deploys).
1 parent 0af5585 commit 9b11aae

6 files changed

Lines changed: 123 additions & 68 deletions

File tree

.github/release-drafter.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name-template: 'v$RESOLVED_VERSION'
2+
tag-template: 'v$RESOLVED_VERSION'
3+
4+
categories:
5+
- title: 'New features'
6+
labels:
7+
- 'feat'
8+
- 'feature'
9+
- title: 'Fixes'
10+
labels:
11+
- 'fix'
12+
- 'bugfix'
13+
- 'bug'
14+
- title: 'Documentation'
15+
labels:
16+
- 'docs'
17+
- 'documentation'
18+
- title: 'Maintenance'
19+
labels:
20+
- 'chore'
21+
- 'ci'
22+
- 'refactor'
23+
- 'deps'
24+
25+
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
26+
change-title-escapes: '\<*_&'
27+
28+
version-resolver:
29+
major:
30+
labels:
31+
- 'major'
32+
- 'breaking'
33+
minor:
34+
labels:
35+
- 'minor'
36+
- 'feat'
37+
- 'feature'
38+
patch:
39+
labels:
40+
- 'patch'
41+
- 'fix'
42+
- 'bugfix'
43+
- 'docs'
44+
- 'chore'
45+
- 'ci'
46+
default: patch
47+
48+
template: |
49+
$CHANGES
50+
51+
Thanks to everyone who contributed: $CONTRIBUTORS
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Release Drafter
2+
3+
on:
4+
pull_request:
5+
types: [opened, reopened, synchronize, labeled]
6+
7+
jobs:
8+
update-release-draft:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: write # create/update release draft
12+
pull-requests: read # read PR titles and labels to generate the notes
13+
steps:
14+
- uses: release-drafter/release-drafter@v7
15+
env:
16+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yml

Lines changed: 56 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
name: Release
22

33
on:
4-
release:
5-
types: [published, prereleased]
4+
push:
5+
tags:
6+
- 'v*'
67

78
permissions:
89
contents: read
@@ -14,13 +15,14 @@ env:
1415
jobs:
1516
build-release:
1617
runs-on: ubuntu-latest
17-
# Needs write access to attach .so/.dll/.inc to the GitHub release
18-
# and to amend the release body with the auto-generated notes.
18+
# Needs write access to create the release and upload .so/.dll/.inc.
1919
permissions:
2020
contents: write
2121

2222
steps:
2323
- uses: actions/checkout@v6
24+
with:
25+
fetch-depth: 0 # full history so the generate-notes API can list every commit
2426

2527
- name: Verify Cargo.toml version matches release tag
2628
run: |
@@ -70,57 +72,76 @@ jobs:
7072
cp "target/i686-pc-windows-msvc/release/${PLUGIN_NAME}.dll" "dist/${PLUGIN_NAME}.dll"
7173
cp "include/${PLUGIN_NAME}.inc" "dist/${PLUGIN_NAME}.inc"
7274
73-
- name: Generate release notes
75+
- name: Build release body
76+
env:
77+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7478
run: |
75-
SDK_VERSION="$(grep -oP 'tag\s*=\s*"\Kv[0-9][^"]*' Cargo.toml | head -n1)"
76-
PLUGIN_VERSION="$(grep -m1 '^version' Cargo.toml | sed 's/.*= *"\(.*\)"/\1/')"
77-
78-
# Extract the section for the current version from CHANGELOG.md.
79-
# Format: "## [X.Y.Z] — yyyy/mm/dd" up to the next "## " heading.
80-
CHANGELOG_SECTION=""
81-
if [ -f CHANGELOG.md ]; then
82-
CHANGELOG_SECTION="$(awk -v ver="${PLUGIN_VERSION}" '
83-
$0 ~ "^## \\[" ver "\\]" { capture = 1; next }
84-
capture && /^## / { exit }
85-
capture { print }
86-
' CHANGELOG.md)"
79+
TAG="${GITHUB_REF_NAME}"
80+
VERSION="${TAG#v}"
81+
82+
# 1. Curated section from CHANGELOG.md — headlines, migration notes,
83+
# breaking changes. Everything that humans wrote and the API cannot
84+
# infer from PR titles alone.
85+
BODY=$(awk "/^## \[?v?${VERSION}\]?/{found=1; next} found && /^## /{exit} found{print}" CHANGELOG.md)
86+
if [ -z "$BODY" ]; then
87+
BODY="See [CHANGELOG.md](CHANGELOG.md) for details."
8788
fi
8889
89-
cat > release_body.md <<EOF
90-
## ${PLUGIN_NAME} v${PLUGIN_VERSION}
91-
92-
Built on top of [rust-samp ${SDK_VERSION}](https://github.com/NullSablex/rust-samp/releases/tag/${SDK_VERSION}).
90+
# 2. Auto-generated notes — used only to borrow the "New Contributors"
91+
# block and the "Full Changelog" comparison link that GitHub computes
92+
# natively. The "## What's Changed" categorisation produced here is
93+
# dropped on purpose; the CHANGELOG already does that job with more
94+
# context.
95+
AUTO=$(gh api -X POST "repos/${GITHUB_REPOSITORY}/releases/generate-notes" \
96+
-f tag_name="$TAG" \
97+
-q .body 2>/dev/null || echo "")
98+
99+
# Everything from "## New Contributors" onwards already includes the
100+
# "Full Changelog" link as its last line. Fall back to just the link
101+
# if no first-time contributors were detected.
102+
APPENDIX=$(echo "$AUTO" | sed -n '/^## New Contributors$/,$p')
103+
if [ -z "$APPENDIX" ]; then
104+
APPENDIX=$(echo "$AUTO" | grep '^\*\*Full Changelog\*\*' | tail -1)
105+
fi
93106
107+
# 3. Artifact orientation footer — what each downloadable file is,
108+
# plus a pointer to the installation docs. Kept at the bottom so it
109+
# doesn't push the actual release notes below the fold.
110+
FOOTER=$(cat <<EOF
94111
### Artifacts
112+
95113
- \`${PLUGIN_NAME}.so\` — Linux i686 (\`i686-unknown-linux-gnu\`).
96114
- \`${PLUGIN_NAME}.dll\` — Windows i686 (\`i686-pc-windows-msvc\`).
97115
- \`${PLUGIN_NAME}.inc\` — Pawn include, identical file for SA-MP and Open Multiplayer.
98116
99-
### Compatibility
100-
The binaries are **universal**: they run on SA-MP and on Open Multiplayer, on Linux and Windows alike.
101-
102-
- **SA-MP**: drop the binary into \`plugins/\` and register it under \`plugins=\` in \`server.cfg\`.
103-
- **Open Multiplayer (native mode, recommended)**: drop the binary into the server's \`components/\` folder. It is loaded automatically via \`ComponentEntryPoint\`, with access to \`ICore\`, \`ITimersComponent\` and the remaining native APIs. No \`config.json\` entry is required.
104-
- **Open Multiplayer (legacy mode)**: drop the binary into \`plugins/\` and declare it under \`pawn.legacy_plugins\` in \`config.json\`. Same binary, no extra build flags.
117+
The same \`.so\` / \`.dll\` runs on SA-MP and on Open Multiplayer (native component or legacy). Installation paths: see [\`docs/installation.md\`](https://github.com/${GITHUB_REPOSITORY}/blob/master/docs/installation.md).
105118
EOF
119+
)
106120
107-
if [ -n "${CHANGELOG_SECTION}" ]; then
108-
{
121+
{
122+
echo "$BODY"
123+
if [ -n "$APPENDIX" ]; then
109124
echo ""
110-
echo "### Changelog"
125+
echo "---"
111126
echo ""
112-
echo "${CHANGELOG_SECTION}"
113-
} >> release_body.md
114-
fi
127+
echo "$APPENDIX"
128+
fi
129+
echo ""
130+
echo "---"
131+
echo ""
132+
echo "$FOOTER"
133+
} > release_body.md
115134
116135
cat release_body.md
117136
118-
- name: Upload release assets
137+
- name: Create GitHub Release
119138
uses: softprops/action-gh-release@v3
120139
with:
140+
name: ${{ github.ref_name }}
121141
body_path: release_body.md
122-
append_body: true
123142
files: |
124143
dist/${{ env.PLUGIN_NAME }}.so
125144
dist/${{ env.PLUGIN_NAME }}.dll
126145
dist/${{ env.PLUGIN_NAME }}.inc
146+
draft: false
147+
prerelease: false

CHANGELOG.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ Format inspired by [Keep a Changelog](https://keepachangelog.com/). Versioning f
1010

1111
- `MYSQL_OPT_SSL` and `MYSQL_OPT_SSL_CA` are now wired through to the connection builder. When `MYSQL_OPT_SSL` is enabled, `mysql_connect` configures `SslOpts::default()` on the pool (rustls). When `MYSQL_OPT_SSL_CA` is also set, its path is passed to `with_root_cert_path`; otherwise the platform trust store is used. Previously both options were accepted but silently ignored, so connections were always plaintext.
1212

13-
---
14-
1513
## [1.1.0] — 2026/05/18
1614

1715
Built on top of [rust-samp v3.0.0](https://github.com/NullSablex/rust-samp/releases/tag/v3.0.0). The same `.so` / `.dll` now loads on SA-MP and on Open Multiplayer (native component or legacy mode). No Pawn-visible API was removed or renamed.
@@ -72,8 +70,6 @@ Built on top of [rust-samp v3.0.0](https://github.com/NullSablex/rust-samp/relea
7270
- `log` removed as a direct dependency (re-exported by `samp`).
7371
- GitHub Actions bumped to the current major: `actions/checkout` v4 → v6, `actions/setup-python` v5 → v6, `actions/cache` v4 → v5, `actions/upload-artifact` v4 → v7, `softprops/action-gh-release` v2 → v3, `rustsec/audit-check` v2.0.0 → v2 (floats within the major for patches).
7472

75-
---
76-
7773
## [1.0.0] — 2026/03/09
7874

7975
First stable release. Added ORM, cache, threaded query pipeline, full safety net.
@@ -157,8 +153,6 @@ First stable release. Added ORM, cache, threaded query pipeline, full safety net
157153
- UTF-8 forced via `SET NAMES utf8mb4` on every pool connection — blocks multi-byte escape-bypass attacks.
158154
- Auto reconnect retries dropped connections once before reporting through `OnQueryError`.
159155

160-
---
161-
162156
## Historical releases
163157

164158
- [v0.x](changelog/v0.x.md) — 0.1.0

CNAME

Lines changed: 0 additions & 1 deletion
This file was deleted.

RELEASE.md

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)