Update CI #63
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Compile Plugin | |
on: | |
push: | |
branches: [ master ] | |
tags: [ '*' ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
SM_VERSION: ['1.11.x', '1.12.x'] | |
steps: | |
- uses: actions/[email protected] | |
- uses: benjlevesque/[email protected] | |
id: short-sha | |
- name: Set environment variables | |
run: | | |
SOURCEMOD_PATH=$GITHUB_WORKSPACE/addons/sourcemod | |
BUILD_PATH=$GITHUB_WORKSPACE/build | |
echo "SOURCEMOD_PATH=$SOURCEMOD_PATH" >> $GITHUB_ENV | |
echo "BUILD_PATH=$BUILD_PATH" >> $GITHUB_ENV | |
echo "SCRIPTS_PATH=$SOURCEMOD_PATH/scripting" >> $GITHUB_ENV | |
echo "INCLUDES_PATH=$SOURCEMOD_PATH/scripting/include" >> $GITHUB_ENV | |
echo "PLUGINS_PATH=$SOURCEMOD_PATH/plugins" >> $GITHUB_ENV | |
- name: Setup SourcePawn Compiler ${{ matrix.SM_VERSION }} | |
id: setup_sp | |
uses: rumblefrog/setup-sp@master | |
with: | |
version: ${{ matrix.SM_VERSION }} | |
- name: Make Folders | |
run: | | |
mkdir include | |
working-directory: ${{ env.SCRIPTS_PATH }} | |
# To-Do: Stop using wget and checkout the repo | |
- name: Get Include Files | |
run: | | |
echo "Begin downloading include files" | |
wget https://raw.githubusercontent.com/JoinedSenses/SourceMod-IncludeLibrary/master/include/steamworks.inc -O steamworks.inc | |
wget https://raw.githubusercontent.com/nosoop/tf2attributes/master/scripting/include/tf2attributes.inc -O tf2attributes.inc | |
wget https://raw.githubusercontent.com/nosoop/SM-TFUtils/master/scripting/include/tf2utils.inc -O tf2utils.inc | |
wget https://raw.githubusercontent.com/asherkin/TF2Items/master/pawn/tf2items.inc -O tf2items.inc | |
wget https://raw.githubusercontent.com/Impact123/AutoExecConfig/development/autoexecconfig.inc -O autoexecconfig.inc | |
wget https://raw.githubusercontent.com/Bara/Multi-Colors/master/addons/sourcemod/scripting/include/multicolors.inc -O multicolors.inc | |
mkdir multicolors | |
cd multicolors | |
wget https://raw.githubusercontent.com/Bara/Multi-Colors/master/addons/sourcemod/scripting/include/multicolors/colors.inc -O colors.inc | |
wget https://raw.githubusercontent.com/Bara/Multi-Colors/master/addons/sourcemod/scripting/include/multicolors/morecolors.inc -O morecolors.inc | |
echo "Done downloading include files." | |
ls -la | |
working-directory: ${{ env.INCLUDES_PATH }} | |
- name: Compile plugins | |
run: | | |
for file in tf_bwr_redux.sp | |
do | |
echo -e "\nCompiling $file..." | |
spcomp -w234 -O2 -v2 -i include $file | |
done | |
echo "===OUT FILES===" | |
ls | |
working-directory: ${{ env.SCRIPTS_PATH }} | |
- name: Post Build | |
run: | | |
echo "Creating build folder" | |
mkdir build | |
mkdir -p build/addons/sourcemod/configs/bwrr/ | |
mkdir -p build/addons/sourcemod/gamedata | |
mkdir -p build/addons/sourcemod/plugins | |
mkdir -p build/addons/sourcemod/translations | |
mv $SCRIPTS_PATH/tf_bwr_redux.smx $BUILD_PATH/addons/sourcemod/plugins/tf_bwr_redux.smx | |
mv $SOURCEMOD_PATH/configs/bwrr/* $BUILD_PATH/addons/sourcemod/configs/bwrr/ | |
mv $SOURCEMOD_PATH/gamedata/tf2.bwrr.txt $BUILD_PATH/addons/sourcemod/gamedata/tf2.bwrr.txt | |
mv $SOURCEMOD_PATH/translations/* $BUILD_PATH/addons/sourcemod/translations/ | |
cd build | |
ls -la | |
- name: Upload Artifact | |
uses: actions/[email protected] | |
with: | |
name: tf-bwrr-${{ matrix.SM_VERSION }}-${{ steps.short-sha.outputs.sha }} | |
path: | | |
${{ env.BUILD_PATH }}/* | |
- name: Create Release Package | |
if: startsWith(github.ref, 'refs/tags/') | |
working-directory: build | |
run: | | |
7z a -bb3 -mx9 -r "tf-bwr-redux-${{ matrix.SM_VERSION }}-${{ steps.short-sha.outputs.sha }}.zip" addons | |
ls -la | |
# Cache release package to be retreived by the create_release job | |
- name: Cache Release Package | |
if: startsWith(github.ref, 'refs/tags/') | |
uses: actions/[email protected] | |
id: cache | |
with: | |
path: | | |
build/*.zip | |
key: bwrr-${{ github.ref_name }}-${{ matrix.SM_VERSION }} | |
# Job for creating a release, waits for build_main to finish | |
create_release: | |
name: Upload Release | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: [ build ] | |
steps: | |
- name: Retreive Release Package From Cache 1.11 | |
uses: actions/[email protected] | |
id: cache2 | |
with: | |
path: | | |
build/*.zip | |
key: bwrr-${{ github.ref_name }}-1.11.x | |
- name: Retreive Release Package From Cache 1.12 | |
uses: actions/[email protected] | |
id: cache3 | |
with: | |
path: | | |
build/*.zip | |
key: bwrr-${{ github.ref_name }}-1.12.x | |
- name: Create Release | |
uses: softprops/[email protected] | |
with: | |
name: "Be With Robots Redux ${{ github.ref_name }}" | |
generate_release_notes: true | |
files: | | |
build/*.zip |