1+ name : CI
2+
3+ on : [push, pull_request, workflow_dispatch]
4+
5+ jobs :
6+ build :
7+ name : " Build"
8+ runs-on : ${{ matrix.os }}
9+ strategy :
10+ fail-fast : false
11+ matrix :
12+ os : [ubuntu-24.04]
13+ include :
14+ - os : ubuntu-24.04
15+ steps :
16+ - uses : actions/checkout@v6
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+
27+ - name : Upload build archive for test runners
28+ uses : actions/upload-artifact@v7
29+ with :
30+ name : ${{ runner.os }}
31+ path : /tmp/package
32+
33+ tag :
34+ name : Tag
35+ needs : build
36+ runs-on : ubuntu-latest
37+ steps :
38+ - uses : actions/checkout@v6
39+ if : github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main'
40+
41+ - uses : dev-drprasad/delete-tag-and-release@v1.1
42+ if : github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main'
43+ with :
44+ delete_release : true
45+ tag_name : latest
46+ env :
47+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
48+
49+ - uses : rickstaa/action-create-tag@v1
50+ if : github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main'
51+ with :
52+ tag : " latest"
53+ github_token : ${{ secrets.GITHUB_TOKEN }}
54+
55+ release :
56+ name : Release
57+ if : startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main'
58+ needs : [build, tag]
59+ runs-on : ubuntu-latest
60+ steps :
61+ - name : Download artifacts
62+ uses : actions/download-artifact@v8
63+ with :
64+ name : ${{ runner.os }}
65+ path : artifacts
66+
67+ - name : Versioning
68+ run : |
69+ version="latest"
70+ if [[ "${{ github.ref_type }}" == 'tag' ]]; then
71+ version=`echo $GITHUB_REF | sed "s/refs\/tags\///"`;
72+ fi
73+ echo "RELEASE_VERSION=$version" >> $GITHUB_ENV
74+
75+ - name : Package
76+ run : |
77+ cd artifacts
78+ ls -Rall
79+ tar -czf ../${{ github.event.repository.name }}-${{ env.RELEASE_VERSION }}.tar.gz .
80+ cd ..
81+ ls -la *.tar.gz
82+
83+ - name : Release
84+ uses : svenstaro/upload-release-action@v2
85+ with :
86+ repo_token : ${{ secrets.GITHUB_TOKEN }}
87+ file : ' *.tar.gz'
88+ tag : ${{ env.RELEASE_VERSION }}
89+ file_glob : true
90+ overwrite : true
0 commit comments