Skip to content

Don't upload upload folder #171

Don't upload upload folder

Don't upload upload folder #171

Workflow file for this run

name: Compile test and upload
on:
push:
branches:
- dev
jobs:
workflow:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: get_branch_name
- name: Set environment variables
run: |
git fetch --unshallow
echo "COMMIT=$(git rev-list --count HEAD)" >> $GITHUB_ENV
echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
SOURCEMOD_PATH=$GITHUB_WORKSPACE/addons/sourcemod
echo "SOURCEMOD_PATH=$SOURCEMOD_PATH" >> $GITHUB_ENV
echo "PLUGINS_PATH=$SOURCEMOD_PATH/plugins" >> $GITHUB_ENV
echo "GAMEDATA_PATH=$SOURCEMOD_PATH/gamedata" >> $GITHUB_ENV
echo "SCRIPTING_PATH=$SOURCEMOD_PATH/scripting" >> $GITHUB_ENV
echo "INCLUDE_PATH=$SOURCEMOD_PATH/scripting/include" >> $GITHUB_ENV
echo "TRANSLATIONS_PATH=$SOURCEMOD_PATH/translations" >> $GITHUB_ENV
- name: Setup SourcePawn Compiler 1.11
uses: rumblefrog/setup-sp@master
with:
version: "1.11"
- name: Fetch plugin dependencies
run: |
wget https://raw.githubusercontent.com/peace-maker/DHooks2/dynhooks/sourcemod_files/scripting/include/dhooks.inc -P $INCLUDE_PATH
wget https://raw.githubusercontent.com/Impact123/AutoExecConfig/development/autoexecconfig.inc -P $INCLUDE_PATH
wget https://raw.githubusercontent.com/c0rp3n/colorlib-sm/master/addons/sourcemod/scripting/include/colorlib.inc -P $INCLUDE_PATH
- name: Replace version with git commit number
run: |
sed -i "s/1.0.dev/1.0.dev${{ env.COMMIT }}-${{ env.SHORT_SHA }}-${{ steps.get_branch_name.outputs.branch }}/g" $SCRIPTING_PATH/SurfTimer.sp
- name: Download EndTouchFix source and gamedata file
run: |
wget https://github.com/rumourA/End-Touch-Fix/raw/master/scripting/EndTouchFix.sp -P $SCRIPTING_PATH
wget https://github.com/rumourA/End-Touch-Fix/raw/master/gamedata/endtouch.games.txt -P $GAMEDATA_PATH
- name: Download EndTouchFix source and gamedata file
run: |
wget https://github.com/rumourA/End-Touch-Fix/raw/master/scripting/EndTouchFix.sp -P $SCRIPTING_PATH
wget https://github.com/rumourA/End-Touch-Fix/raw/master/gamedata/endtouch.games.txt -P $GAMEDATA_PATH
- name: Download SurfTimer Mapchooser source and translations file
run: |
wget https://github.com/surftimer/SurfTimer-Mapchooser/raw/master/addons/sourcemod/scripting/st-mapchooser.sp -P $SCRIPTING_PATH
wget https://github.com/surftimer/SurfTimer-Mapchooser/raw/master/addons/sourcemod/scripting/st-nominations.sp -P $SCRIPTING_PATH
wget https://github.com/surftimer/SurfTimer-Mapchooser/raw/master/addons/sourcemod/scripting/st-rockthevote.sp -P $SCRIPTING_PATH
wget https://github.com/surftimer/SurfTimer-Mapchooser/raw/master/addons/sourcemod/scripting/st-voteextend.sp -P $SCRIPTING_PATH
wget https://github.com/surftimer/SurfTimer-Mapchooser/raw/master/addons/sourcemod/translations/st-mapchooser.phrases.txt -P $TRANSLATIONS_PATH
wget https://github.com/surftimer/SurfTimer-Mapchooser/raw/master/addons/sourcemod/translations/st-nominations.phrases.txt -P $TRANSLATIONS_PATH
wget https://github.com/surftimer/SurfTimer-Mapchooser/raw/master/addons/sourcemod/translations/st-rockthevote.phrases.txt -P $TRANSLATIONS_PATH
wget https://github.com/surftimer/SurfTimer-Mapchooser/raw/master/addons/sourcemod/translations/st-voteextend.phrases.txt -P $TRANSLATIONS_PATH
- name: Create upload directories
run: |
mkdir -p ./upload/csgo/addons/sourcemod/plugins/SurfTimer
mkdir -p ./upload/csgo/addons/sourcemod/translations
mkdir -p ./upload/csgo/addons/sourcemod/gamedata
- name: Move gamedata and translation files
run: |
mv ./addons/sourcemod/translations/surftimer.phrases.txt ./upload/csgo/addons/sourcemod/translations
mv ./addons/sourcemod/translations/st-{mapchooser,nominations,rockthevote,voteextend}.phrases.txt ./upload/csgo/addons/sourcemod/translations
mv ./addons/sourcemod/gamedata/endtouch.games.txt ./upload/csgo/addons/sourcemod/gamedata
- name: Compile plugins
run: |
mkdir -p $PLUGINS_PATH
for file in *.sp
do
echo -e "\nCompiling $file..."
spcomp -w234 -O2 -v2 -i $includePath -i $INCLUDE_PATH -o $GITHUB_WORKSPACE/upload/csgo/addons/sourcemod/plugins/SurfTimer/$file $file
done
working-directory: ${{ env.SCRIPTING_PATH }}
# - name: Upload files to EU
# uses: wlixcc/[email protected]
# with:
# server: ${{ secrets.SFTP_HOST_EU }}
# port: ${{ secrets.SFTP_PORT_EU }}
# username: ${{ secrets.SFTP_USER_EU }}
# password: ${{ secrets.SFTP_PASS_EU }}
# local_path: './upload/*'
# remote_path: './'
# sftp_only: true
- name: Upload files to NA
uses: wlixcc/[email protected]
with:
server: ${{ secrets.SFTP_HOST }}
port: ${{ secrets.SFTP_PORT }}
username: ${{ secrets.SFTP_USER }}
password: ${{ secrets.SFTP_PASS }}
local_path: './upload/*'
remote_path: './'
sftp_only: true
# - name: Restart EU test server
# shell: bash
# run: |
# curl --request POST \
# --url ${{ secrets.BASE_URL_EU }}api/client/servers/${{ secrets.SERVER_ID_EU }}/power \
# --header 'Accept: application/json' \
# --header 'Authorization: Bearer ${{ secrets.API_KEY_EU }}' \
# --header 'Content-Type: application/json' \
# --data '{ "signal": "restart" }'
- name: Restart NA test server
shell: bash
run: |
curl --request POST \
--url ${{ secrets.BASE_URL }}api/client/servers/${{ secrets.SERVER_ID }}/power \
--header 'Accept: application/json' \
--header 'Authorization: Bearer ${{ secrets.API_KEY }}' \
--header 'Content-Type: application/json' \
--data '{ "signal": "restart" }'