Try add workflow
Some checks failed
Update Website / update (push) Failing after 4s

This commit is contained in:
Kagura 2024-11-23 23:41:43 +08:00
parent da69c1ab5b
commit a3f54466f2
2 changed files with 31 additions and 2 deletions

View file

@ -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"

View file

@ -106,7 +106,7 @@ function FoodList({ list, setList }: {
{list.map((item) => {list.map((item) =>
<div <div
key={item.name} key={item.name}
className="flex flex-col sm:flex-row gap-5 bg-slate-200 rounded-md shadow-md border-spacing-1 px-5 py-3 relative" className="flex flex-col sm:flex-row gap-5 bg-slate-200 rounded-md shadow-md border-spacing-1 px-8 sm:px-5 py-3 relative"
> >
<img className="size-24 rounded-full" {...item.image} /> <img className="size-24 rounded-full" {...item.image} />
<div className="flex-1"> <div className="flex-1">
@ -179,7 +179,7 @@ const FoodOrderer = () => {
const [items, setItems] = useState<ShopItem[]>(shopItems) const [items, setItems] = useState<ShopItem[]>(shopItems)
return ( return (
<div className="flex flex-col items-center gap-2"> <div className="flex flex-col items-center gap-2">
<p className="text-center text-2xl sm:text-5xl py-5 sm:py-10 bg-gradient-to-r from-blue-600 to-pink-600 via-green-700 inline-block text-transparent bg-clip-text"> <p className="text-center text-5xl py-5 sm:py-10 bg-gradient-to-r from-blue-600 to-pink-600 via-green-700 inline-block text-transparent bg-clip-text">
</p> </p>
<FoodList list={items} setList={setItems} /> <FoodList list={items} setList={setItems} />