Skip to content

Commit 35af031

Browse files
committed
feat: sourceknight support
feat(ci): automatic tag and release
1 parent 1333456 commit 35af031

File tree

3 files changed

+123
-34
lines changed

3 files changed

+123
-34
lines changed

.github/workflows/build.yml

Lines changed: 78 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: Build & Deploy
2-
on: [push]
2+
3+
on:
4+
- push
5+
- pull_request
36

47
env:
58
SCRVER: ${{ github.sha }}
@@ -96,50 +99,33 @@ jobs:
9699

97100
client:
98101
name: Build Client
99-
runs-on: ubuntu-latest
102+
runs-on: ${{ matrix.os }}
100103

101104
strategy:
105+
fail-fast: false
102106
matrix:
103-
sm-version: ["1.10.x", "1.11.x"]
107+
os: [ubuntu-20.04]
108+
include:
109+
- os: ubuntu-20.04
104110

105111
steps:
106-
- name: Checkout source
107-
uses: actions/checkout@master
108-
109-
- name: Set version env
110-
run: echo ::set-env name=SCRVER::$(git describe --always --long --dirty)
111-
112-
- name: Setup SourcePawn Compiler ${{ matrix.sm-version }}
113-
id: setup-sp
114-
uses: rumblefrog/setup-sp@master
112+
- uses: actions/checkout@v3
113+
- name: Build sourcemod plugin
114+
uses: maxime1907/action-sourceknight@v1
115115
with:
116-
version: ${{ matrix.sm-version }}
116+
cmd: build
117117

118-
- name: Create external dependency directory
119-
run: mkdir includes
120-
121-
- name: Update version file
122-
working-directory: client
123-
run: envsubst < SCR-Version.inc > SCR-Version.inc.temp && mv SCR-Version.inc.temp SCR-Version.inc
124-
125-
- name: Fetch plugin dependencies
118+
- name: Create package
126119
run: |
127-
wget https://raw.githubusercontent.com/nefarius/sm-ext-socket/master/socket.inc -P includes
128-
wget https://raw.githubusercontent.com/rumblefrog/SM-ByteBuffer-Inc/master/bytebuffer.inc -P includes
129-
wget https://www.doctormckay.com/download/scripting/include/morecolors.inc -P includes
130-
131-
- name: Create build folder
132-
run: mkdir build
133-
134-
- name: Compile client against SM ${{ steps.setup-sp.outputs.version }}
135-
run: spcomp64 -iincludes client/Source-Chat-Relay.sp -o build/Source-Chat-Relay.smx
120+
mkdir -p /tmp/package
121+
cp -R .sourceknight/package/* /tmp/package
136122
137-
- name: Upload plugin artifact
138-
if: matrix.sm-version == '1.10.x'
139-
uses: actions/upload-artifact@master
123+
- name: Upload build archive for test runners
124+
uses: actions/upload-artifact@v3
140125
with:
141126
name: Plugin
142-
path: build/
127+
path: /tmp/package
128+
143129
doc:
144130
name: Build Documentation
145131
runs-on: ubuntu-latest
@@ -166,3 +152,61 @@ jobs:
166152
- name: Build documentation
167153
working-directory: docs
168154
run: yarn gatsby build --prefix-paths
155+
156+
tag:
157+
name: Tag
158+
needs:
159+
- client
160+
- server
161+
runs-on: ubuntu-latest
162+
steps:
163+
- uses: actions/checkout@v3
164+
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main'
165+
166+
- uses: dev-drprasad/delete-tag-and-release@v0.2.1
167+
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main'
168+
with:
169+
delete_release: true
170+
tag_name: latest
171+
env:
172+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
173+
174+
- uses: rickstaa/action-create-tag@v1
175+
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main'
176+
with:
177+
tag: "latest"
178+
github_token: ${{ secrets.GITHUB_TOKEN }}
179+
180+
release:
181+
name: Release
182+
if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main'
183+
needs:
184+
- client
185+
- server
186+
- tag
187+
runs-on: ubuntu-latest
188+
steps:
189+
- name: Download artifacts
190+
uses: actions/download-artifact@v3
191+
192+
- name: Versioning
193+
run: |
194+
version="latest"
195+
if [[ "${{ github.ref_type }}" == 'tag' ]]; then
196+
version=`echo $GITHUB_REF | sed "s/refs\/tags\///"`;
197+
fi
198+
echo "RELEASE_VERSION=$version" >> $GITHUB_ENV
199+
200+
- name: Package
201+
run: |
202+
ls -Rall
203+
tar -czf ${{ github.event.repository.name }}-${{ env.RELEASE_VERSION }}.tar.gz Plugin Server
204+
205+
- name: Release
206+
uses: svenstaro/upload-release-action@v2
207+
with:
208+
repo_token: ${{ secrets.GITHUB_TOKEN }}
209+
file: '*.tar.gz'
210+
tag: ${{ env.RELEASE_VERSION }}
211+
file_glob: true
212+
overwrite: true

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,10 @@ server/ui/template/dist/*
4949
.cache/
5050
.docz
5151
public
52+
53+
# Python
54+
.venv
55+
56+
# Sourceknight
57+
.sourceknight
58+
*.smx

sourceknight.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
project:
2+
sourceknight: 0.2
3+
name: SourceChatRelay
4+
dependencies:
5+
- name: sourcemod
6+
type: tar
7+
version: 1.11.0-git6934
8+
location: https://sm.alliedmods.net/smdrop/1.11/sourcemod-1.11.0-git6934-linux.tar.gz
9+
unpack:
10+
- source: /addons
11+
dest: /addons
12+
13+
- name: ext-socket
14+
type: git
15+
repo: https://github.com/nefarius/sm-ext-socket
16+
unpack:
17+
- source: /
18+
dest: /addons/sourcemod/scripting/include
19+
20+
- name: multicolors
21+
type: git
22+
repo: https://github.com/Bara/Multi-Colors
23+
unpack:
24+
- source: /addons/sourcemod/scripting/include
25+
dest: /addons/sourcemod/scripting/include
26+
27+
- name: bytebuffer
28+
type: git
29+
repo: https://github.com/rumblefrog/SM-ByteBuffer-Inc
30+
unpack:
31+
- source: /
32+
dest: /addons/sourcemod/scripting/include
33+
34+
root: /client
35+
workdir: /
36+
output: /addons/sourcemod/plugins
37+
targets:
38+
- Source-Chat-Relay

0 commit comments

Comments
 (0)