* Use deploy workflow for staging, too * Reduce deploy.sh script
This commit is contained in:
parent
f6668636a9
commit
3f2bf9c3dc
3 changed files with 26 additions and 83 deletions
31
.github/workflows/deploy.yml
vendored
31
.github/workflows/deploy.yml
vendored
|
@ -1,6 +1,6 @@
|
||||||
name: Deploy (Production)
|
name: Deploy
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
hostname:
|
hostname:
|
||||||
|
@ -10,9 +10,30 @@ on:
|
||||||
default: antville.org
|
default: antville.org
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
stage:
|
||||||
runs-on: antville
|
runs-on: antville
|
||||||
|
|
||||||
|
environment:
|
||||||
|
name: production
|
||||||
|
url: ${{ inputs.hostname }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Copy files to production server
|
- uses: actions/checkout@v4
|
||||||
run: ssh ${{ inputs.hostname }} deploy-helma
|
|
||||||
|
- 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
|
||||||
|
|
39
.github/workflows/stage.yml
vendored
39
.github/workflows/stage.yml
vendored
|
@ -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
|
|
39
src/dist/extras/deploy.sh
vendored
39
src/dist/extras/deploy.sh
vendored
|
@ -3,50 +3,11 @@
|
||||||
# Use this script as forced command of an authorized SSH key:
|
# Use this script as forced command of an authorized SSH key:
|
||||||
# command="/home/helma/extras/deploy.sh" ssh-ed25519 AAAAC3NzaC…
|
# 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
|
case "$SSH_ORIGINAL_COMMAND" in
|
||||||
ping)
|
ping)
|
||||||
echo pong
|
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)
|
restart)
|
||||||
printf 'Restarting Helma… '
|
printf 'Restarting Helma… '
|
||||||
sudo /bin/systemctl restart helma
|
sudo /bin/systemctl restart helma
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue