Skip to content

Commit 325692b

Browse files
committed
Use amxx-builder
1 parent 159861a commit 325692b

10 files changed

Lines changed: 83 additions & 12 deletions

File tree

.github/workflows/ci.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [master, feature/**, fix/**]
6+
paths-ignore:
7+
- "**.md"
8+
pull_request:
9+
types: [opened, reopened, synchronize]
10+
release:
11+
types: [published]
12+
13+
jobs:
14+
build:
15+
name: Build
16+
runs-on: ubuntu-latest
17+
outputs:
18+
sha: ${{ steps.sha.outputs.SHORT }}
19+
name: ${{ steps.build.outputs.name }}
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- id: sha
24+
run: echo "SHORT=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
25+
26+
- id: build
27+
uses: AmxxModularEcosystem/amxx-builder@v1
28+
with:
29+
set: |
30+
output.pack=false
31+
output.dir=./artifact
32+
33+
- uses: actions/upload-artifact@v4
34+
with:
35+
name: ${{ steps.build.outputs.name }}-${{ steps.sha.outputs.SHORT }}-dev
36+
path: artifact/
37+
38+
publish:
39+
name: Publish release
40+
runs-on: ubuntu-latest
41+
needs: [build]
42+
if: |
43+
github.event_name == 'release' &&
44+
github.event.action == 'published' &&
45+
startsWith(github.ref, 'refs/tags/')
46+
steps:
47+
- uses: actions/download-artifact@v4
48+
with:
49+
name: ${{ needs.build.outputs.name }}-${{ needs.build.outputs.sha }}-dev
50+
path: artifact/
51+
52+
- name: Package for release
53+
run: |
54+
cd artifact
55+
zip -r "../${{ needs.build.outputs.name }}-${{ github.ref_name }}.zip" .
56+
57+
- uses: softprops/action-gh-release@v2
58+
with:
59+
files: "${{ needs.build.outputs.name }}-*.zip"

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
*.amxx
2+
*.zip
3+
.claude
4+
build
5+
dist

addons/amxmodx/configs/plugins-prefs.ini

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

amxbuild.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: PlayerPreferences-API
2+
3+
amxmodx:
4+
version: "1.10.5428"
5+
6+
deps:
7+
- Next21Team/AmxxEasyHttp@1.4.0:amxx/scripting/include
8+
9+
output:
10+
dir: ./
11+
archive_name: "{name}.zip"
12+
amxmodx_path: "{name}/addons/amxmodx"
13+
readme: false
14+
generate_ini: true
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"url": "https://example.com",
33
"token": "<bearer-here>",
4-
"x_api_key": "<x-api-here>",
54
"server_id": 1,
65
"timeout": 60.0
76
}
File renamed without changes.

addons/amxmodx/scripting/include/player_prefs_provider.inc renamed to amxmodx/scripting/include/player_prefs_provider.inc

File renamed without changes.
File renamed without changes.
File renamed without changes.

addons/amxmodx/scripting/player_prefs_flute.sma renamed to amxmodx/scripting/player_prefs_flute.sma

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ enum _: RequestData
2828

2929
new g_szBaseUrl[MAX_URL_LENGTH];
3030
new g_szAuthHeader[MAX_TOKEN_LENGTH + 8];
31-
new g_szApiKey[MAX_TOKEN_LENGTH];
31+
new g_szToken[MAX_TOKEN_LENGTH];
3232

3333
new g_iServerId;
3434
new g_iTimeoutMs;
@@ -315,7 +315,7 @@ EzHttpOptions: BuildRequestOptions()
315315
new EzHttpOptions: hOptions = ezhttp_create_options();
316316

317317
ezhttp_option_set_header(hOptions, "Authorization", g_szAuthHeader);
318-
ezhttp_option_set_header(hOptions, "X-API-Key", g_szApiKey);
318+
ezhttp_option_set_header(hOptions, "X-API-Key", g_szToken);
319319
ezhttp_option_set_header(hOptions, "Accept", "application/json");
320320
ezhttp_option_set_timeout(hOptions, g_iTimeoutMs);
321321

@@ -339,11 +339,8 @@ bool: ReadConfig()
339339
return false;
340340
}
341341

342-
new szToken[MAX_TOKEN_LENGTH];
343-
344342
json_object_get_string(hConfig, "url", g_szBaseUrl, charsmax(g_szBaseUrl));
345-
json_object_get_string(hConfig, "token", szToken, charsmax(szToken));
346-
json_object_get_string(hConfig, "x_api_key", g_szApiKey, charsmax(g_szApiKey));
343+
json_object_get_string(hConfig, "token", g_szToken, charsmax(g_szToken));
347344
g_iServerId = json_object_get_number(hConfig, "server_id");
348345
g_iTimeoutMs = json_object_get_number(hConfig, "timeout");
349346

@@ -356,9 +353,9 @@ bool: ReadConfig()
356353
if (iLen > 0 && g_szBaseUrl[iLen - 1] == '/')
357354
g_szBaseUrl[iLen - 1] = EOS;
358355

359-
formatex(g_szAuthHeader, charsmax(g_szAuthHeader), "Bearer %s", szToken);
356+
formatex(g_szAuthHeader, charsmax(g_szAuthHeader), "Bearer %s", g_szToken);
360357

361-
if (g_szBaseUrl[0] == EOS || szToken[0] == EOS || g_iServerId <= 0)
358+
if (g_szBaseUrl[0] == EOS || g_szToken[0] == EOS || g_iServerId <= 0)
362359
{
363360
log_amx("[PP Flute] Конфиг неполный: нужны url, token и server_id > 0.");
364361
return false;

0 commit comments

Comments
 (0)