fix:更新cicd

This commit is contained in:
Your Name
2026-04-17 21:21:47 +08:00
parent 3e20a2141b
commit d010af7656
2 changed files with 48 additions and 0 deletions

38
.gitea/workflows/main.yml Normal file
View File

@@ -0,0 +1,38 @@
name: main
on:
push:
branches: [main]
jobs:
main:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: 构建镜像
run: |
docker build -t react-app .
docker save react-app | gzip > app.tar.gz
- name: 复制到服务器并运行
uses: appleboy/scp-action@v0.1.5
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.SSH_KEY }}
source: "app.tar.gz"
target: "/tmp/"
- name: 部署
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.SSH_KEY }}
script: |
gunzip -c /tmp/app.tar.gz | docker load
docker stop react-app 2>/dev/null || true
docker rm react-app 2>/dev/null || true
docker run -d --name react-app -p 8080:80 --restart always react-app
rm -f /tmp/app.tar.gz