From 3f2bf9c3dc0a785d6d045d8a33bc4799c76ca34b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobi=20Sch=C3=A4fer?= Date: Sun, 25 May 2025 17:00:10 +0200 Subject: [PATCH] Simplify repository workflows * Use deploy workflow for staging, too * Reduce deploy.sh script --- .github/workflows/deploy.yml | 31 +++++++++++++++++++++++----- .github/workflows/stage.yml | 39 ------------------------------------ src/dist/extras/deploy.sh | 39 ------------------------------------ 3 files changed, 26 insertions(+), 83 deletions(-) delete mode 100644 .github/workflows/stage.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 5a011f69..9eeb14b0 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,6 +1,6 @@ -name: Deploy (Production) +name: Deploy -on: +on: workflow_dispatch: inputs: hostname: @@ -10,9 +10,30 @@ on: default: antville.org jobs: - deploy: + stage: runs-on: antville + environment: + name: production + url: ${{ inputs.hostname }} + steps: - - name: Copy files to production server - run: ssh ${{ inputs.hostname }} deploy-helma + - uses: actions/checkout@v4 + + - name: Build with Gradle + run: ./gradlew installDist + + - name: Copy build files to server + run: | + rsync ./build/install/helma/ ${{ inputs.hostname }}:./ \ + --verbose --archive --delete --compress \ + --filter '+ /bin' \ + --filter '+ /extras' \ + --filter '+ /launcher.jar' \ + --filter '- /lib/ext' \ + --filter '+ /lib' \ + --filter '+ /modules' \ + --filter '- /*' + + - name: Restart Helma + run: ssh ${{ inputs.hostname }} restart diff --git a/.github/workflows/stage.yml b/.github/workflows/stage.yml deleted file mode 100644 index 94e991cf..00000000 --- a/.github/workflows/stage.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: Deploy (Staging) - -on: - workflow_dispatch: - inputs: - hostname: - description: Hostname - type: string - required: true - default: antville.org - -jobs: - stage: - runs-on: antville - - environment: - name: stage - url: ${{ inputs.hostname }} - - steps: - - uses: actions/checkout@v4 - - - name: Build with Gradle - run: ./gradlew installDist - - - name: Copy build files to server - run: | - rsync ./build/install/helma/ ${{ inputs.hostname }}:./ \ - --verbose --archive --delete --compress \ - --filter '+ /bin' \ - --filter '+ /extras' \ - --filter '+ /launcher.jar' \ - --filter '- /lib/ext' \ - --filter '+ /lib' \ - --filter '+ /modules' \ - --filter '- /*' - - - name: Restart Helma - run: ssh ${{ inputs.hostname }} restart diff --git a/src/dist/extras/deploy.sh b/src/dist/extras/deploy.sh index 6ebd6bf2..869cf945 100755 --- a/src/dist/extras/deploy.sh +++ b/src/dist/extras/deploy.sh @@ -3,50 +3,11 @@ # Use this script as forced command of an authorized SSH key: # command="/home/helma/extras/deploy.sh" ssh-ed25519 AAAAC3NzaC… -# Define HELMA_HOST and ANTVILLE_HOST in this file -# shellcheck source=/dev/null -. "$HOME"/deploy.env - case "$SSH_ORIGINAL_COMMAND" in ping) echo pong ;; - deploy-helma) - rsync ./ "$HELMA_HOST":./ \ - --archive --compress --delete --verbose \ - --filter '+ /bin' \ - --filter '+ /extras' \ - --filter '+ /launcher.jar' \ - --filter '- /lib/ext' \ - --filter '+ /lib' \ - --filter '+ /modules' \ - --filter '- /*' - printf 'Restarting Helma on HELMA_host… ' - ssh "$HELMA_HOST" sudo /bin/systemctl restart helma - ;; - - deploy-antville) - rsync ./apps/antville/ "$ANTVILLE_HOST":./apps/antville/ \ - --archive --compress --delete --verbose \ - --filter '+ /claustra' \ - --filter '+ /code' \ - --filter '+ /compat' \ - --filter '+ /i18n' \ - --filter '+ /lib' \ - --filter '- /*' - rsync ./apps/antville/static/helma/ "$ANTVILLE_HOST":./apps/antville/static/helma/ \ - --archive --compress --verbose \ - --filter '+ /fonts' \ - --filter '+ /formica.html' \ - --filter '+ /img' \ - --filter '+ /scripts' \ - --filter '+ /styles' \ - --filter '- /*' - printf 'Restarting Helma on ANTVILLE_host… ' - ssh "$ANTVILLE_HOST" sudo /bin/systemctl restart helma - ;; - restart) printf 'Restarting Helma… ' sudo /bin/systemctl restart helma