From 3e1d1c82920ae0e6ad44e786f241df5c79dd7ca3 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Wed, 8 May 2024 17:41:15 +0200 Subject: [PATCH] added github action to deploy the server --- .editorconfig | 3 +++ .github/workflows/server.yml | 22 ++++++++++++++++++++++ .woodpecker/server.yml | 13 ------------- 3 files changed, 25 insertions(+), 13 deletions(-) create mode 100644 .github/workflows/server.yml delete mode 100644 .woodpecker/server.yml diff --git a/.editorconfig b/.editorconfig index 02905fd..4132eb5 100644 --- a/.editorconfig +++ b/.editorconfig @@ -7,3 +7,6 @@ insert_final_newline = true indent_style = space indent_size = 4 tab_width = 4 + +[{*.yml,*.yaml}] +indent_size = 2 diff --git a/.github/workflows/server.yml b/.github/workflows/server.yml new file mode 100644 index 0000000..854f154 --- /dev/null +++ b/.github/workflows/server.yml @@ -0,0 +1,22 @@ +on: + push: + branches: [main] +jobs: + deploy-server: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + # this is a beautiful way to deploy a website and i will not take any criticism + # (though maybe if you self-host this, you should use a better way to deploy your site) + - name: Deploy + run: | + apt update && apt install -y rsync + curl -L --output cloudflared.deb https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb && sudo dpkg -i cloudflared.deb + echo "${{ secrets.ELLBOT_KEY }}" > ~/.ssh/id_rsa && chmod 600 ~/.ssh/id_rsa + rsync -rv --delete -e 'ssh -o "ProxyCommand cloudflared access ssh --hostname %h" -o "StrictHostKeyChecking=no"' server/public/ ellbot@ssh.ellpeck.de:/var/www/jsp/public + - name: Purge Cloudflare cache + uses: https://github.com/NathanVaughn/actions-cloudflare-purge@v3.1.0 + with: + cf_zone: ${{ secrets.CLOUDFLARE_ZONE }} + cf_auth: ${{ secrets.CLOUDFLARE_TOKEN }} diff --git a/.woodpecker/server.yml b/.woodpecker/server.yml deleted file mode 100644 index 13b6eea..0000000 --- a/.woodpecker/server.yml +++ /dev/null @@ -1,13 +0,0 @@ -when: - path: "server/**" -steps: - deploy-server: - image: debian:latest - when: - - event: [push, manual] - branch: main - commands: - - rm -rfv /var/www/jsp/public/* - - cp -rv server/. /var/www/jsp - volumes: - - /var/www/jsp:/var/www/jsp