30 lines
No EOL
983 B
YAML
30 lines
No EOL
983 B
YAML
on:
|
|
push:
|
|
branches:
|
|
- 'master'
|
|
jobs:
|
|
build:
|
|
runs-on:
|
|
- kiljho
|
|
container:
|
|
image: git.php.fail/lubiana/container/php:ci
|
|
steps:
|
|
- name: Update Service
|
|
env:
|
|
SSH_PRIVATE_KEY: ${{ secrets.SSH_KEY }}
|
|
HOST: '172.19.0.1'
|
|
USERNAME: 'michel'
|
|
TARGETDIR: '/mnt/drive/containers/gamesshop'
|
|
run: |
|
|
mkdir -p ~/.ssh/
|
|
echo "$SSH_PRIVATE_KEY" | tr -d '\r' > ~/.ssh/id_rsa
|
|
chmod 600 ~/.ssh/id_rsa
|
|
|
|
ssh-keyscan -H $HOST >> ~/.ssh/known_hosts
|
|
|
|
# Stop service
|
|
ssh ${USERNAME}@${HOST} "cd ${TARGETDIR}/deploy && sudo docker compose down -v"
|
|
# Update Service
|
|
ssh ${USERNAME}@${HOST} "cd ${TARGETDIR} && git fetch && git reset --hard origin/master && sudo bash ${TARGETDIR}/deploy/deploy.sh"
|
|
# Start service
|
|
ssh ${USERNAME}@${HOST} "cd ${TARGETDIR}/deploy && sudo docker compose up -d" |