ReactLearn/.forgejo/workflows/update.yaml
Kagura a3f54466f2
Some checks failed
Update Website / update (push) Failing after 4s
Try add workflow
2024-11-23 23:41:43 +08:00

29 lines
No EOL
904 B
YAML

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: 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 "root@$SSH_HOST" "cd ReactLearn; git pull; docker compose restart"