11name : Build & Deploy
2- on : [push]
2+
3+ on :
4+ - push
5+ - pull_request
36
47env :
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 -T <(\ls -1)
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
0 commit comments