Skip to content

Merge pull request #162 from Injector/master #19

Merge pull request #162 from Injector/master

Merge pull request #162 from Injector/master #19

name: Build and deploy
on:
push:
pull_request:
branches: [ main ]
jobs:
compile:
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.sm-version == '1.12.x' }}
strategy:
matrix:
sm-version: [ '1.10.x', '1.11.x', '1.12.x' ]
compiler-options: [ '', '__MADEBUG=1' ]
env:
BUILDS_URL: ${{ secrets.BUILDS_URL }}
BUILDS_KEY: ${{ secrets.BUILDS_KEY }}
DEBUG: ${{ contains(matrix.compiler-options, '__MADEBUG=1') }}
name: "SM version ${{ matrix.sm-version }} ${{ matrix.compiler-options != '' && format('({0})', matrix.compiler-options) || '' }}"
steps:
- uses: actions/checkout@v2
- name: Setup SP
uses: rumblefrog/setup-sp@master
with:
version: ${{ matrix.sm-version }}
- name: Run compiler
run: |
cd addons/sourcemod
mkdir plugins
cd scripting
curl -O https://raw.githubusercontent.com/CrazyHackGUT/sm-plugins/master/git.sh
chmod +x git.sh
./git.sh > materialadmin.git.sp
cat ./../../../ci_sm11.sp >> materialadmin.git.sp
spcomp __GITHUB=1 _MATERIALADMIN=1 materialadmin.git.sp -E -o ../plugins/materialadmin -iinclude ${{ matrix.compiler-options }}
spcomp __GITHUB=1 _MATERIALADMIN_ADMINMENU=1 materialadmin.git.sp -E -o ../plugins/ma_adminmenu -iinclude -i${includePath}/.. ${{ matrix.compiler-options }}
spcomp __GITHUB=1 _MATERIALADMIN_BASECOMMS=1 materialadmin.git.sp -E -o ../plugins/ma_basecomm -iinclude ${{ matrix.compiler-options }}
spcomp __GITHUB=1 _MATERIALADMIN_BASEVOTES=1 materialadmin.git.sp -E -o ../plugins/ma_basevotes -iinclude ${{ matrix.compiler-options }}
spcomp __GITHUB=1 _MATERIALADMIN_CHECKER=1 materialadmin.git.sp -E -o ../plugins/ma_checker -iinclude ${{ matrix.compiler-options }}
- name: Cleanup
if: github.ref == 'refs/heads/master'
run: |
cd addons/sourcemod/scripting
rm git.sh materialadmin.git.sp
- name: Make artifact archive
if: github.ref == 'refs/heads/master'
run: |
if [[ "$DEBUG" == "true" ]]; then export CUSTOM_POSTFIX="d"; fi
SMVERSION_FULL=${{ matrix.sm-version }}
export SMVERSION_SHORT=${SMVERSION_FULL:0:-2}
export ARCHIVE_FILENAME=sbma-newplugin.${GITHUB_SHA::7}.${SMVERSION_SHORT}${CUSTOM_POSTFIX}.tar.gz
echo "ARCHIVE_FILENAME=$ARCHIVE_FILENAME" >> $GITHUB_ENV
echo "SMVERSION_SHORT=$SMVERSION_SHORT" >> $GITHUB_ENV
tar -cvf $ARCHIVE_FILENAME addons
- name: Upload artifact to builds.kruzya.me
if: github.ref == 'refs/heads/master'
run: |
if [[ "$DEBUG" == "true" ]]; then export ADDITIONAL_TAGS=",DEBUG"; fi
curl "${BUILDS_URL}?secret_key=${BUILDS_KEY}&tags=SourceMod%20${SMVERSION_SHORT}${ADDITIONAL_TAGS}" -F "artifact=@./${ARCHIVE_FILENAME}"