Compare commits

...

2 commits

Author SHA1 Message Date
57b4e33028
fix paths in prepare deploy and add local deploy script
All checks were successful
/ ls (pull_request) Successful in 31s
/ ls (push) Successful in 31s
2024-06-24 21:19:11 +02:00
b6e0ef44f4
write release workflow file 2024-06-23 11:58:18 +02:00
4 changed files with 30 additions and 2 deletions

View file

@ -18,6 +18,27 @@ jobs:
git checkout ${{ github.head_ref }} git checkout ${{ github.head_ref }}
- name: prepare deploy - name: prepare deploy
run: sh ./deploy/prepare-deploy.sh run: sh ./deploy/prepare-deploy.sh
- name: deploy
env:
HOST: 'web.server.c3h'
USERNAME: 'c3h-futtern'
TARGETDIR: '/home/c3h-futtern/futtern'
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
run: |
mkdir -p ~/.ssh/
# Print the SSH key, replacing newline characters with actual new lines
echo "$SSH_PRIVATE_KEY" | tr -d '\r' > ~/.ssh/id_rsa
# Set appropriate permissions for the SSH key
chmod 600 ~/.ssh/id_rsa
# Add the remote host's key to the known_hosts file to avoid authenticity confirmation
ssh-keyscan -H $HOST >> ~/.ssh/known_hosts
# stop services
ssh ${USERNAME}@${HOST} systemctl --user stop pod-futtern
# SCP files to the remote host
rsync -avz --delete deploy/ ${USERNAME}@${HOST}:${TARGETDIR} --exclude=var
# run update script
ssh ${USERNAME}@${HOST} /home/c3h-futtern/futtern/update.sh

6
deploy/local-deploy.sh Executable file
View file

@ -0,0 +1,6 @@
#!/usr/bin/env sh
. ./deploy/prepare-deploy.sh
ssh leitstelle-futtern 'systemctl --user stop pod-futtern'
rsync -avz --delete deploy/ leitstelle-futtern:futtern --exclude=var
ssh leitstelle-futtern '/home/c3h-futtern/futtern/update.sh'

View file

@ -17,6 +17,7 @@ done
rm ./bin/phpunit rm ./bin/phpunit
APP_ENV=prod composer install --no-dev -a APP_ENV=prod composer install --no-dev -a
rm -rf ./var/cache
cd -

0
deploy/update.sh Normal file → Executable file
View file