From 66f2c0eab05756c00e4d69087d7c679ebfcd4260 Mon Sep 17 00:00:00 2001 From: oxaliq Date: Wed, 22 May 2024 12:47:54 -0400 Subject: [PATCH] add deployment script --- .woodpecker/deploy.sh | 21 +++++++++++++++++++++ .woodpecker/pipeline.yaml | 24 ++++++++++++++++++++++++ {static => src}/index.html | 14 +++++++------- {static => src/scripts}/collision.js | 0 {static => src/scripts}/debug.js | 0 {static => src/scripts}/engine.js | 0 {static => src/scripts}/environment.js | 0 {static => src/scripts}/input.js | 0 {static => src/scripts}/player.js | 0 {static => src/scripts}/transform.js | 0 10 files changed, 52 insertions(+), 7 deletions(-) create mode 100644 .woodpecker/deploy.sh create mode 100644 .woodpecker/pipeline.yaml rename {static => src}/index.html (90%) rename {static => src/scripts}/collision.js (100%) rename {static => src/scripts}/debug.js (100%) rename {static => src/scripts}/engine.js (100%) rename {static => src/scripts}/environment.js (100%) rename {static => src/scripts}/input.js (100%) rename {static => src/scripts}/player.js (100%) rename {static => src/scripts}/transform.js (100%) diff --git a/.woodpecker/deploy.sh b/.woodpecker/deploy.sh new file mode 100644 index 0000000..19e9eee --- /dev/null +++ b/.woodpecker/deploy.sh @@ -0,0 +1,21 @@ +#!/bin/sh -e + +host=root@oxaliq.net +targetdir=/var/www/art.oxaliq.net/html-tower + +echo "COPYING FILES TO DEPLOYMENT TARGET" +scp -r src "$host":~/html-tower + +echo "SETTING OWNERSHIP AND PERMISSIONS" +ssh $host 'chown -R www-data:www-data html-tower/' +ssh $host 'chown -R 755 html-tower' + +echo "REPLACING PREVIOUS DEPLOYMENT" +ssh $host "rm -rf $targetdir || true" +ssh $host "mv html-tower $targetdir" + +echo "RESTARTING SERVICE" +ssh $host 'systemctl restart nginx.service' + +echo "SUCCESS!" +exit 0 diff --git a/.woodpecker/pipeline.yaml b/.woodpecker/pipeline.yaml new file mode 100644 index 0000000..5f909ac --- /dev/null +++ b/.woodpecker/pipeline.yaml @@ -0,0 +1,24 @@ +when: + branch: + include: [ main ] + +# no testing at the moment, just huck it onto the server +steps: + deploy: + image: alpine:latest + secrets: + - oxaliq_deploy_ssh + commands: + - echo "SETTING UP SSH" + - apk add openssh-client + - mkdir -p $HOME/.ssh + - ssh-keyscan -t ed25519 oxaliq.net >> $HOME/.ssh/known_hosts + - echo "$oxaliq_deploy_ssh" > $HOME/.ssh/id_ed25519 + - chmod 0600 $HOME/.ssh/id_ed25519 + - echo "SSH SETUP DONE" + - echo "RUNNING DEPLOY SCRIPT" + - ./.woodpecker/deploy.sh + when: + # Only try to deploy if previous step is successful + status: success + - ssh diff --git a/static/index.html b/src/index.html similarity index 90% rename from static/index.html rename to src/index.html index 8887805..ab32fb8 100644 --- a/static/index.html +++ b/src/index.html @@ -1,13 +1,13 @@ - - - - - - - + + + + + + +