Files
V2_micropython/.gitea/workflows/deploy.yaml
jeremygan2021 609803c792
Some checks failed
Deploy WebSocket Server / deploy (push) Failing after 2s
action
2026-03-04 20:37:16 +08:00

49 lines
1.5 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
name: Deploy WebSocket Server
on:
push:
branches:
- master # 或者是 master请根据您的分支名称修改
jobs:
deploy:
runs-on: ubuntu # 或者您的 Gitea runner 标签1
steps:
- name: Check Secrets
env:
HOST: ${{ secrets.SERVER_HOST }}
USERNAME: ${{ secrets.SERVER_USERNAME }}
PASSWORD: ${{ secrets.SERVER_PASSWORD }}
run: |
if [ -z "$HOST" ]; then echo "Error: SERVER_HOST is not set!"; exit 1; fi
if [ -z "$USERNAME" ]; then echo "Error: SERVER_USERNAME is not set!"; exit 1; fi
if [ -z "$PASSWORD" ]; then echo "Error: SERVER_PASSWORD is not set!"; exit 1; fi
echo "Secrets are correctly loaded."
- name: SSH Remote Commands
uses: docker://ghcr.io/appleboy/ssh-action:v1.0.0
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USERNAME }}
password: ${{ secrets.SERVER_PASSWORD }}
port: 22
script: |
# 进入项目目录
cd /root/V2_micropython/
# 拉取最新代码
echo "Pulling latest code..."
git pull
# 进入 websocket_server 目录
cd websocket_server
# 重启服务
echo "Restarting Docker Compose services..."
docker compose down
docker compose up -d
# 检查部署状态
echo "Checking deployment status..."
docker compose ps