ReactLearn/.forgejo/workflows/update.yaml
Kagura a9352ddd09
All checks were successful
Update Website / update (push) Successful in 4s
Fix: alpine lacks some pkgs
2024-11-23 23:43:16 +08:00

32 lines
No EOL
1,008 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: 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 "root@$SSH_HOST" "cd ReactLearn; git pull; docker compose restart"