chore(deploy): 简化 nginx 路由 + 自动部署 nginx config + 删除 .github workflows
Deploy / deploy (push) Successful in 1m16s
Deploy / deploy (push) Successful in 1m16s
- nginx: /app/ → Flutter,/ 兜底 → 营销站,移除零散 location 块 - deploy.yml: 每次部署自动 scp nginx-jiu.conf 到服务器并 nginx -t reload - deploy.yml: Release 附件新增 configs.tar.gz(nginx/systemd/compose 配置) - 删除 .github/workflows/(已全部迁移到 .gitea/) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -36,6 +36,13 @@ jobs:
|
||||
FORGEJO_URL: ${{ secrets.FORGEJO_URL }}
|
||||
run: |
|
||||
tar -czf web.tar.gz -C client/build web
|
||||
tar -czf configs.tar.gz \
|
||||
deploy/nginx-jiu.conf \
|
||||
deploy/jiu.service \
|
||||
deploy/production.env.template \
|
||||
deploy/setup-ec2.sh \
|
||||
deploy/docker-compose.yml \
|
||||
deploy/docker-compose.jiu.yml
|
||||
VERSION="v$(date +%Y%m%d.%H%M)"
|
||||
COMMIT="${{ gitea.sha }}"
|
||||
COMMIT_MSG=$(git log -1 --pretty="%s" HEAD)
|
||||
@@ -53,6 +60,8 @@ jobs:
|
||||
-H "Authorization: token ${FORGEJO_TOKEN}" -F "attachment=@backend/jiu-server"
|
||||
curl -sf -X POST "${FORGEJO_URL}/api/v1/repos/${{ gitea.repository }}/releases/${RELEASE_ID}/assets" \
|
||||
-H "Authorization: token ${FORGEJO_TOKEN}" -F "attachment=@web.tar.gz"
|
||||
curl -sf -X POST "${FORGEJO_URL}/api/v1/repos/${{ gitea.repository }}/releases/${RELEASE_ID}/assets" \
|
||||
-H "Authorization: token ${FORGEJO_TOKEN}" -F "attachment=@configs.tar.gz"
|
||||
echo "Release ${VERSION} created"
|
||||
|
||||
- name: Setup SSH
|
||||
@@ -72,6 +81,8 @@ jobs:
|
||||
client/build/web/ ${EC2_USER}@${EC2_HOST}:/tmp/jiu-web-new/
|
||||
rsync -avz --delete -e "ssh -i ~/.ssh/ec2_deploy.pem" \
|
||||
web/ ${EC2_USER}@${EC2_HOST}:/tmp/jiu-marketing-new/
|
||||
scp -O -i ~/.ssh/ec2_deploy.pem deploy/nginx-jiu.conf \
|
||||
${EC2_USER}@${EC2_HOST}:/tmp/nginx-jiu.conf
|
||||
ssh -i ~/.ssh/ec2_deploy.pem ${EC2_USER}@${EC2_HOST} << 'ENDSSH'
|
||||
sudo systemctl stop jiu
|
||||
cp /tmp/jiu-server /opt/jiu/backend/jiu-server
|
||||
@@ -87,7 +98,8 @@ jobs:
|
||||
mkdir -p /opt/jiu/marketing
|
||||
rsync -a --delete /tmp/jiu-marketing-new/ /opt/jiu/marketing/
|
||||
rm -rf /tmp/jiu-marketing-new
|
||||
sudo nginx -s reload
|
||||
sudo cp /tmp/nginx-jiu.conf /etc/nginx/conf.d/jiu.conf
|
||||
sudo nginx -t && sudo nginx -s reload
|
||||
ENDSSH
|
||||
|
||||
- name: Cleanup SSH key
|
||||
|
||||
Reference in New Issue
Block a user