Update mapspawn #212
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
# This is a basic workflow to help you get started with Actions | |
name: CI | |
# Controls when the workflow will run | |
on: | |
# Triggers the workflow on push or pull request events but only for the "main" branch | |
push: | |
branches: [ "main" ] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
concurrency: | |
group: main | |
cancel-in-progress: true | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job called "build" | |
build: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v3 | |
with: | |
path: tf/download | |
- uses: zerotier/github-action@v1 | |
with: | |
auth_token: ${{ secrets.ZEROTIER_KEY }} | |
network_id: e4da7455b253a261 | |
# Install wakeonlan | |
- name: Make scripts executable | |
run: sudo apt-get install -y wakeonlan | |
- name: Setup SSH Keys and known_hosts | |
env: | |
SSH_AUTH_SOCK: /tmp/ssh_agent.sock | |
run: | | |
ssh-agent -a $SSH_AUTH_SOCK > /dev/null | |
ssh-add - <<< "${{ secrets.DEPLOY_KEY }}" | |
- name: Create asset pack | |
run: | | |
mv 'tf/download/.github/HOW TO INSTALL!.gif' . | |
{ | |
zip -r gg2-assets.zip tf -x '*/.*' -x '*.bz2' -x 'tf_mvm_missioncycle.res' | |
zip gg2-assets.zip 'HOW TO INSTALL!.gif' | |
} & | |
{ | |
zip -r gg2-assets-no-maps.zip tf -x '*/.*' -x '*.bz2' -x 'tf/download/maps/*' -x 'tf_mvm_missioncycle.res' | |
zip gg2-assets-no-maps.zip 'HOW TO INSTALL!.gif' | |
} & | |
wait | |
rm 'HOW TO INSTALL!.gif' | |
- name: Upload to R2 | |
uses: jakejarvis/s3-sync-action@master | |
with: | |
args: --exclude '*' --include '*.zip' --follow-symlinks --delete | |
env: | |
AWS_S3_BUCKET: fastdl-gg2 | |
AWS_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }} | |
AWS_REGION: 'auto' # optional: defaults to us-east-1 | |
AWS_S3_ENDPOINT: https://d7d00000029f3cf361b520329f5e69df.r2.cloudflarestorage.com | |
- name: Create bz2 archives | |
run: | | |
cd tf/download | |
find . -type f -not \( -name "*.pop" -or -name "*.nav" -or -name "*.res" -or -name "*.bz2" -or -name "*.lua" -or -name "*.nut" \) \( ! -regex '.*/\..*' \) | parallel bzip2 -f -k | |
- name: Sync with game servers | |
env: | |
SSH_AUTH_SOCK: /tmp/ssh_agent.sock | |
run: | | |
cd tf/download | |
{ | |
echo -e "${{ secrets.TOHRU_KEY_USA }}" > /tmp/deploy_key | |
chmod 600 /tmp/deploy_key | |
rsync -a -e "ssh -p 47422 -i /tmp/deploy_key -o StrictHostKeyChecking=no" --delete --update --exclude=".*" --exclude="*.bz2" --exclude="*.zip" . [email protected]:~/tf2server/tf/gg2/ | |
rm -rf /tmp/deploy_key | |
} & | |
{ | |
echo -e "${{ secrets.TOHRU_KEY_EU }}" > /tmp/deploy_key_eu | |
chmod 600 /tmp/deploy_key_eu | |
rsync -a -e "ssh -p 59922 -i /tmp/deploy_key_eu -o StrictHostKeyChecking=no" --delete --update --exclude=".*" --exclude="*.bz2" --exclude="*.zip" . [email protected]:~/tf2server/tf/gg2/ | |
rm -rf /tmp/deploy_key_eu | |
} & | |
for i in "22 [email protected]" "22 [email protected]" "27040 [email protected]" "3438 [email protected]" "22 [email protected]" "22 [email protected]" "22 [email protected]" "22 [email protected]" "22 [email protected]" "22 [email protected]" "27035 [email protected]" "22 [email protected]" "22 [email protected]"; do a=( $i ); | |
{ | |
ssh -o StrictHostKeyChecking=no -p ${a[0]} ${a[1]} "touch /var/tf2server/tf/occupiedservers/wake; exit 0" | |
rsync -a -e "ssh -p ${a[0]} -o StrictHostKeyChecking=no" --delete --update --exclude=".*" --exclude="*.bz2" . ${a[1]}:/var/tf2server/tf/gg2/ | |
ssh -p ${a[0]} -o StrictHostKeyChecking=no ${a[1]} mkdir -p /var/www/html/gameassets/gg2 | |
rsync -a -e "ssh -p ${a[0]} -o StrictHostKeyChecking=no" --delete --update --include="*/" --include="*.bz2" --exclude="*" . ${a[1]}:/var/www/html/gameassets/gg2/ | |
} & | |
done | |
wait |