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,60 @@ jobs:
166152 - name : Build documentation
167153 working-directory : docs
168154 run : yarn gatsby build --prefix-paths
155+
156+ tag :
157+ name : Tag
158+ needs : client
159+ runs-on : ubuntu-latest
160+ steps :
161+ - uses : actions/checkout@v3
162+ if : github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main'
163+
164+ - uses : dev-drprasad/delete-tag-and-release@v0.2.1
165+ if : github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main'
166+ with :
167+ delete_release : true
168+ tag_name : latest
169+ env :
170+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
171+
172+ - uses : rickstaa/action-create-tag@v1
173+ if : github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main'
174+ with :
175+ tag : " latest"
176+ github_token : ${{ secrets.GITHUB_TOKEN }}
177+
178+ release :
179+ name : Release
180+ if : startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main'
181+ needs :
182+ - client
183+ - tag
184+ runs-on : ubuntu-latest
185+ steps :
186+ - name : Download artifacts
187+ uses : actions/download-artifact@v3
188+
189+ - name : Versioning
190+ run : |
191+ version="latest"
192+ if [[ "${{ github.ref_type }}" == 'tag' ]]; then
193+ version=`echo $GITHUB_REF | sed "s/refs\/tags\///"`;
194+ fi
195+ echo "RELEASE_VERSION=$version" >> $GITHUB_ENV
196+
197+ - name : Package
198+ run : |
199+ ls -Rall
200+ cd ./Plugin/
201+ tar -czf ../${{ github.event.repository.name }}-${{ env.RELEASE_VERSION }}.tar.gz -T <(\ls -1)
202+ cd -
203+
204+ - name : Release
205+ uses : svenstaro/upload-release-action@v2
206+ with :
207+ repo_token : ${{ secrets.GITHUB_TOKEN }}
208+ file : ' *.tar.gz'
209+ tag : ${{ env.RELEASE_VERSION }}
210+ file_glob : true
211+ overwrite : true
0 commit comments