From a3f54466f21807c80234fdde37d62f529419875b Mon Sep 17 00:00:00 2001 From: Kagura Date: Sat, 23 Nov 2024 23:41:43 +0800 Subject: [PATCH] Try add workflow --- .forgejo/workflows/update.yaml | 29 +++++++++++++++++++++++++++++ src/FoodOrderer.tsx | 4 ++-- 2 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 .forgejo/workflows/update.yaml diff --git a/.forgejo/workflows/update.yaml b/.forgejo/workflows/update.yaml new file mode 100644 index 0000000..3cddea7 --- /dev/null +++ b/.forgejo/workflows/update.yaml @@ -0,0 +1,29 @@ +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" \ No newline at end of file diff --git a/src/FoodOrderer.tsx b/src/FoodOrderer.tsx index e605a5d..cb01a5f 100644 --- a/src/FoodOrderer.tsx +++ b/src/FoodOrderer.tsx @@ -106,7 +106,7 @@ function FoodList({ list, setList }: { {list.map((item) =>
@@ -179,7 +179,7 @@ const FoodOrderer = () => { const [items, setItems] = useState(shopItems) return (
-

+

点些什么