From 14ccdf06910f2c131b4070f3abd752a079001f15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobi=20Sch=C3=A4fer?= Date: Sat, 1 Jun 2024 20:48:01 +0200 Subject: [PATCH] Add deployment workflow --- .github/workflows/deploy.yml | 26 ++++++++++++++++++ src/dist/extras/deploy.sh | 52 ------------------------------------ 2 files changed, 26 insertions(+), 52 deletions(-) create mode 100644 .github/workflows/deploy.yml delete mode 100644 src/dist/extras/deploy.sh diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 00000000..fb6355e9 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,26 @@ +name: Deploy (Production) + +on: + workflow_dispatch: {} + push: + branches: + - helma-🐜 + +jobs: + deploy: + runs-on: ubuntu-latest + + environment: + name: p3k.org + url: https://blog.p3k.org + + steps: + - name: Set up SSH agent + uses: antville/helma/.github/actions/ssh@helma-🐜 + with: + config: ${{ vars.SSH_CONFIG }} + key: ${{ secrets.SSH_PRIVATE_KEY }} + known-hosts: ${{ vars.SSH_KNOWN_HOSTS }} + + - name: Copy files to production server + run: ssh staging-server deploy-helma diff --git a/src/dist/extras/deploy.sh b/src/dist/extras/deploy.sh deleted file mode 100644 index fa426a8b..00000000 --- a/src/dist/extras/deploy.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/sh - -# Use this script as forced command of an authorized SSH key: -# command="/home/helma/extras/deploy.sh" ssh-ed25519 AAAAC3NzaC… - -case "$SSH_ORIGINAL_COMMAND" in - ping) - echo pong - ;; - - deploy-helma) - rsync ./ p3k.org:./ \ - --archive --compress --delete --verbose \ - --filter '+ /bin' \ - --filter '+ /extras' \ - --filter '+ /launcher.jar' \ - --filter '- /lib/ext' \ - --filter '+ /lib' \ - --filter '+ /modules' \ - --filter '- /*' - ;; - - deploy-antville) - rsync ./apps/antville/ p3k.org:./apps/antville/ \ - --archive --compress --delete --verbose \ - --filter '+ /claustra' \ - --filter '+ /code' \ - --filter '+ /compat' \ - --filter '+ /i18n' \ - --filter '+ /lib' \ - --filter '- /*' - rsync ./apps/antville/static/helma/ p3k.org:/var/www/weblogs.at/ \ - --archive --compress --verbose \ - --filter '+ /fonts' \ - --filter '+ /formica.html' \ - --filter '+ /img' \ - --filter '+ /scripts' \ - --filter '+ /styles' \ - --filter '- /*' - ;; - - restart) - printf 'Restarting Helma… ' - sudo /bin/systemctl restart helma - printf '%s\n' 'done.' - ;; - - *) - # Allow any rsync command but restrict it to the installation directory - rrsync -wo /home/helma - ;; -esac