Files
tonePage/.gitea/workflows/deploy.yml
tone efc87cdbaf
Some checks failed
Deploy to K3s / deploy (push) Failing after 15s
chore: 调整版本为v6
2025-12-20 12:53:53 +08:00

45 lines
1.3 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 to K3s
on:
push:
branches:
- master
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Build and push backend image
run: |
cd apps/backend
docker build -t localhost:5000/backend:latest .
docker push localhost:5000/backend:latest
- name: Build and push frontend image
run: |
cd apps/frontend
docker build \
--build-arg API_BASE="http://backend-service:3001" \
-t localhost:5000/frontend:latest .
docker push localhost:5000/frontend:latest
- name: Deploy to K3s
run: |
cd apps/deploy
# 应用基础设施配置Secrets 已手动创建YAML 中不含敏感数据)
kubectl apply -f postgres-deployment.yaml
kubectl apply -f backend-deployment.yaml
kubectl apply -f frontend-deployment.yaml
# 强制滚动更新以加载新镜像(因使用 latest 标签)
kubectl rollout restart deployment/backend
kubectl rollout restart deployment/frontend
# 可选:等待部署完成(增强可靠性)
kubectl rollout status deployment/backend --timeout=120s
kubectl rollout status deployment/frontend --timeout=120s