Skip to content

Commit 08d0834

Browse files
authored
Refactor structure (move into standard addons/sourcemod file structure) (#18)
1 parent 8d66829 commit 08d0834

84 files changed

Lines changed: 166 additions & 26900 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build-and-release.yml

Lines changed: 166 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -17,75 +17,170 @@ permissions:
1717
jobs:
1818
build:
1919
runs-on: ubuntu-latest
20-
20+
strategy:
21+
matrix:
22+
sm-version: [ '1.12' ]
23+
24+
name: "Build for SM ${{ matrix.sm-version }}"
25+
if: github.ref_type == 'tag'
26+
steps:
27+
- name: Checkout repository
28+
uses: actions/checkout@v4
29+
with:
30+
fetch-depth: 0
31+
32+
- name: Setup SP
33+
uses: rumblefrog/setup-sp@master
34+
with:
35+
version: ${{ matrix.sm-version }}
36+
37+
- name: Download ripext dependency
38+
shell: bash
39+
run: |
40+
# Mac zip just because it's smaller & we don't repack the extensions...
41+
wget https://github.com/ErikMinekus/sm-ripext/releases/download/1.3.1/sm-ripext-1.3.1-mac.zip
42+
unzip sm-ripext-1.3.1-mac.zip "addons/sourcemod/scripting/include/*"
43+
44+
45+
- name: Run compiler
46+
shell: bash
47+
run: |
48+
cd addons/sourcemod
49+
mkdir -p plugins
50+
for src in $(find scripting -maxdepth 1 -type f -name "*.sp");
51+
do
52+
spcomp $src -o=plugins/$(basename $src .sp)'.smx' -i=scripting/include -v2
53+
done
54+
55+
- name: Upload artifact
56+
uses: actions/upload-artifact@v4
57+
with:
58+
name: offstyle-database-${{ github.head_ref || github.ref_name }}-sm${{ matrix.sm-version }}
59+
path: |
60+
addons
61+
retention-days: 14
62+
63+
release:
64+
name: Release
65+
if: github.ref_type == 'tag'
66+
needs: build
67+
runs-on: ubuntu-latest
2168
steps:
22-
- name: Checkout repository
23-
uses: actions/checkout@v4
24-
with:
25-
fetch-depth: 0
26-
27-
- name: Make compile script and compiler executable
28-
run: |
29-
chmod +x compile.sh
30-
chmod +x spcomp spcomp64
31-
32-
- name: Compile plugin
33-
run: ./compile.sh offstyledb.sp
34-
35-
- name: Check if compiled file exists
36-
run: |
37-
if [ ! -f "./compiled/offstyledb.smx" ]; then
38-
echo "Error: Compiled plugin not found!"
39-
exit 1
40-
fi
41-
ls -la compiled/
42-
43-
- name: Get tag name
44-
id: get_tag
45-
run: |
46-
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
47-
echo "tag_name=${{ github.event.inputs.tag_name }}" >> $GITHUB_OUTPUT
48-
else
49-
echo "tag_name=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
50-
fi
51-
52-
- name: Generate changelog
53-
id: changelog
54-
run: |
55-
current_tag=${{ steps.get_tag.outputs.tag_name }}
56-
previous_tag=$(git tag --sort=-version:refname | head -n 2 | tail -n 1 || echo "")
57-
if [ -n "$previous_tag" ]; then
58-
commits=$(git log --oneline $previous_tag..$current_tag)
59-
body="Automated release of Offstyle Database plugin
60-
61-
## Changes
62-
$commits
63-
64-
## Installation
65-
1. Download \`offstyledb.smx\`
66-
2. Upload to your SourceMod plugins directory
67-
3. Restart your server or use \`sm plugins reload offstyledb\`"
68-
else
69-
body="Automated release of Offstyle Database plugin
70-
71-
## Changes
72-
- Initial release
73-
74-
## Installation
75-
1. Download \`offstyledb.smx\`
76-
2. Upload to your SourceMod plugins directory
77-
3. Restart your server or use \`sm plugins reload offstyledb\`"
78-
fi
79-
echo "body<<EOF" >> $GITHUB_OUTPUT
80-
echo "$body" >> $GITHUB_OUTPUT
81-
echo "EOF" >> $GITHUB_OUTPUT
82-
83-
- name: Create Release
84-
uses: softprops/action-gh-release@v1
85-
with:
86-
tag_name: ${{ steps.get_tag.outputs.tag_name }}
87-
name: Release ${{ steps.get_tag.outputs.tag_name }}
88-
body: ${{ steps.changelog.outputs.body }}
89-
files: ./compiled/offstyledb.smx
90-
draft: false
91-
prerelease: false
69+
- name: Checkout repository
70+
uses: actions/checkout@v4
71+
with:
72+
fetch-depth: 0
73+
74+
- name: Download artifacts
75+
uses: actions/download-artifact@v4
76+
77+
- name: Zip it up
78+
shell: bash
79+
run: |
80+
artifact_dir=$(find * -maxdepth 0 -type d -name "offstyle-database-*" | head -n 1)
81+
zip_name="offstyle-database-${{ github.ref_name }}.zip"
82+
cd "$artifact_dir"
83+
mkdir -p addons
84+
mv sourcemod addons/
85+
zip -rq "../$zip_name" addons/
86+
cd ..
87+
echo "zip_file=$zip_name" >> $GITHUB_ENV
88+
89+
- name: Generate changelog
90+
id: changelog
91+
run: |
92+
current_tag=${{ github.ref_name }}
93+
previous_tag=$(git tag --sort=-version:refname | head -n 2 | tail -n 1 || echo "")
94+
if [ -n "$previous_tag" ]; then
95+
commits=$(git log --oneline $previous_tag..$current_tag)
96+
body="Automated release of Offstyle Database plugin
97+
98+
## Changes
99+
$commits
100+
101+
## Installation
102+
1. Download and extract the zip file
103+
2. Upload the contents to your server
104+
3. Restart your server or reload the plugins
105+
106+
## Files included
107+
- Compiled plugins in \`addons/sourcemod/plugins/\`
108+
- Source files in \`addons/sourcemod/scripting/\`"
109+
else
110+
body="Automated release of Offstyle Database plugin
111+
112+
## Changes
113+
- Initial release
114+
115+
## Installation
116+
1. Download and extract the zip file
117+
2. Upload the contents to your server
118+
3. Restart your server or reload the plugins
119+
120+
## Files included
121+
- Compiled plugins in \`addons/sourcemod/plugins/\`
122+
- Source files in \`addons/sourcemod/scripting/\`"
123+
fi
124+
echo "body<<EOF" >> $GITHUB_OUTPUT
125+
echo "$body" >> $GITHUB_OUTPUT
126+
echo "EOF" >> $GITHUB_OUTPUT
127+
128+
- name: Create Release
129+
id: create_release
130+
uses: ncipollo/release-action@v1
131+
with:
132+
token: ${{ secrets.GITHUB_TOKEN }}
133+
tag: ${{ github.ref_name }}
134+
name: Release ${{ github.ref_name }}
135+
body: ${{ steps.changelog.outputs.body }}
136+
artifacts: "*.zip"
137+
draft: false
138+
prerelease: false
139+
140+
notify:
141+
name: Discord Notification
142+
if: github.ref_type == 'tag'
143+
needs: release
144+
runs-on: ubuntu-latest
145+
steps:
146+
- name: Checkout repository
147+
uses: actions/checkout@v4
148+
with:
149+
fetch-depth: 0
150+
151+
- name: Download artifacts
152+
uses: actions/download-artifact@v4
153+
154+
- name: Create Discord zip
155+
shell: bash
156+
run: |
157+
artifact_dir=$(find * -maxdepth 0 -type d -name "offstyle-database-*" | head -n 1)
158+
zip_name="offstyle-database-${{ github.ref_name }}.zip"
159+
cd "$artifact_dir"
160+
mkdir -p addons
161+
mv sourcemod addons/
162+
zip -rq "../$zip_name" addons/
163+
cd ..
164+
echo "zip_file=$zip_name" >> $GITHUB_ENV
165+
166+
- name: Get commit list
167+
id: commits
168+
run: |
169+
current_tag=${{ github.ref_name }}
170+
previous_tag=$(git tag --sort=-version:refname | head -n 2 | tail -n 1 || echo "")
171+
if [ -n "$previous_tag" ]; then
172+
commits=$(git log --oneline $previous_tag..$current_tag)
173+
else
174+
commits="Initial release"
175+
fi
176+
echo "list<<EOF" >> $GITHUB_OUTPUT
177+
echo "$commits" >> $GITHUB_OUTPUT
178+
echo "EOF" >> $GITHUB_OUTPUT
179+
180+
- name: Notify Discord
181+
uses: tsickert/discord-webhook@v7.0.0
182+
with:
183+
webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }}
184+
filename: ${{ env.zip_file }}
185+
content: |
186+
${{ steps.commits.outputs.list }}

.gitignore

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

include/convar_class.inc renamed to addons/sourcemod/scripting/include/convar_class.inc

File renamed without changes.

include/sha1.inc renamed to addons/sourcemod/scripting/include/sha1.inc

File renamed without changes.

compile.exe

-111 KB
Binary file not shown.

compile.sh

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

0 commit comments

Comments
 (0)