name: Update Website on: [push] jobs: update: runs-on: docker container: image: alpine:3.18 env: SSH_PRIVATE_KEY: ${{ secrets.SSH_KEY }} SSH_PASSWORD: ${{ secrets.SSH_PASSWD }} SSH_HOST: ${{ secrets.SSH_HOST }} steps: - name: Install required packages run: | apk add --no-cache openssh-client bash - name: Set up SSH key run: | mkdir -p ~/.ssh echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_ed25519 chmod 600 ~/.ssh/id_ed25519 - name: Add SSH host to known_hosts run: | ssh-keyscan -H "$SSH_HOST" >> ~/.ssh/known_hosts - name: SSH and execute command env: SSH_ASKPASS: /tmp/ssh-pass.sh run: | echo "#!/bin/bash" > /tmp/ssh-pass.sh echo "echo $SSH_PASSWORD" >> /tmp/ssh-pass.sh chmod +x /tmp/ssh-pass.sh DISPLAY=:0 ssh -o StrictHostKeyChecking=no "app-runner@$SSH_HOST" "cd ReactLearn; git pull; docker compose restart"