Skip to content

Commit a47d90a

Browse files
authored
feat(game): automatic github ci build, tag, release (#879)
1 parent 982c8db commit a47d90a

File tree

3 files changed

+116
-1
lines changed

3 files changed

+116
-1
lines changed

.github/workflows/plugin.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: CI
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
name: "Build"
8+
runs-on: ${{ matrix.os }}
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
os: [ubuntu-20.04]
13+
include:
14+
- os: ubuntu-20.04
15+
steps:
16+
- uses: actions/checkout@v3
17+
- name: Build sourcemod plugin
18+
uses: maxime1907/action-sourceknight@v1
19+
with:
20+
cmd: build
21+
22+
- name: Create package
23+
run: |
24+
mkdir -p /tmp/package
25+
cp -R .sourceknight/package/* /tmp/package
26+
cp -R game/addons/sourcemod/configs /tmp/package/common/addons/sourcemod/
27+
cp -R game/addons/sourcemod/translations /tmp/package/common/addons/sourcemod/
28+
- name: Upload build archive for test runners
29+
uses: actions/upload-artifact@v3
30+
with:
31+
name: ${{ runner.os }}
32+
path: /tmp/package
33+
34+
tag:
35+
name: Tag
36+
needs: build
37+
runs-on: ubuntu-latest
38+
steps:
39+
- uses: actions/checkout@v3
40+
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/php81'
41+
42+
- uses: dev-drprasad/delete-tag-and-release@v0.2.1
43+
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/php81'
44+
with:
45+
delete_release: true
46+
tag_name: latest
47+
env:
48+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49+
50+
- uses: rickstaa/action-create-tag@v1
51+
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/php81'
52+
with:
53+
tag: "latest"
54+
github_token: ${{ secrets.GITHUB_TOKEN }}
55+
56+
release:
57+
name: Release
58+
if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/php81'
59+
needs: [build, tag]
60+
runs-on: ubuntu-latest
61+
steps:
62+
- name: Download artifacts
63+
uses: actions/download-artifact@v3
64+
65+
- name: Versioning
66+
run: |
67+
version="latest"
68+
if [[ "${{ github.ref_type }}" == 'tag' ]]; then
69+
version=`echo $GITHUB_REF | sed "s/refs\/tags\///"`;
70+
fi
71+
echo "RELEASE_VERSION=$version" >> $GITHUB_ENV
72+
- name: Package
73+
run: |
74+
ls -Rall
75+
if [ -d "./Linux/" ]; then
76+
cd ./Linux/
77+
tar -czf ../${{ github.event.repository.name }}-${{ env.RELEASE_VERSION }}.tar.gz -T <(\ls -1)
78+
cd -
79+
fi
80+
- name: Release
81+
uses: svenstaro/upload-release-action@v2
82+
with:
83+
repo_token: ${{ secrets.GITHUB_TOKEN }}
84+
file: '*.tar.gz'
85+
tag: ${{ env.RELEASE_VERSION }}
86+
file_glob: true
87+
overwrite: true

.gitignore

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,11 @@ Temporary Items
5757
.vscode
5858

5959
# Composer vendor dir
60-
/web/includes/vendor
60+
/web/includes/vendor
61+
62+
# Plugin compilation
63+
build/
64+
release/
65+
plugins/
66+
.sourceknight
67+
.venv

sourceknight.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
project:
2+
sourceknight: 0.1
3+
name: SBPP
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+
root: /game
14+
output: /game/addons/sourcemod/plugins
15+
targets:
16+
- sbpp_admcfg
17+
- sbpp_checker
18+
- sbpp_comms
19+
- sbpp_main
20+
- sbpp_report
21+
- sbpp_sleuth

0 commit comments

Comments
 (0)