Merge pull request #93 from svc-design/codex/combine-jobs-1-and-jobs-2-into-pipeline

feat: add unified deployment pipeline
This commit is contained in:
shenlan 2025-08-09 13:12:25 +08:00 committed by GitHub
commit d79a558b07
7 changed files with 115 additions and 0 deletions

41
.github/workflows/deploy-all.yml vendored Normal file
View File

@ -0,0 +1,41 @@
name: Unified Deploy Pipeline
on:
workflow_dispatch:
jobs:
deploy-homepage:
uses: ./.github/workflows/deploy-homepage.yml
secrets: inherit
deploy-xcontrol-panel:
uses: ./.github/workflows/deploy-xcontrol-panel.yml
secrets: inherit
deploy-xcontrol-server:
uses: ./.github/workflows/deploy-xcontrol-server.yml
secrets: inherit
deploy-proxy-nginx:
needs:
- deploy-homepage
- deploy-xcontrol-panel
- deploy-xcontrol-server
uses: ./.github/workflows/deploy-proxy-nginx.yml
secrets: inherit
setup-proxy-cn-homepage:
needs:
- deploy-homepage
- deploy-xcontrol-panel
- deploy-xcontrol-server
uses: ./.github/workflows/setup-proxy-cn-homepage.yml
secrets: inherit
setup-proxy-global-homepage:
needs:
- deploy-homepage
- deploy-xcontrol-panel
- deploy-xcontrol-server
uses: ./.github/workflows/setup-proxy-global-homepage.yml
secrets: inherit

View File

@ -10,6 +10,7 @@ on:
- 'ui/homepage/**'
- '.github/workflows/deploy-homepage.yml'
branches: [main]
workflow_call:
jobs:
deploy:

View File

@ -2,6 +2,7 @@ name: Configure Proxy Nginx
on:
workflow_dispatch:
workflow_call:
jobs:
setup-nginx:

View File

@ -10,6 +10,7 @@ on:
- 'ui/panel/**'
- '.github/workflows/deploy-xcontrol-panel.yml'
branches: [main]
workflow_call:
jobs:
deploy:

View File

@ -0,0 +1,24 @@
name: Deploy Xcontrol Server
on:
workflow_dispatch:
workflow_call:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: 📦 Checkout source code
uses: actions/checkout@v4
- name: 🧰 Setup Go
uses: actions/setup-go@v4
with:
go-version: '1.21'
- name: 🏗️ Build server
run: go build ./cmd/api
- name: 🚀 Deploy server
run: |
echo "Deploying server..."

View File

@ -6,6 +6,7 @@ on:
dummy:
description: 'Manual trigger'
required: false
workflow_call:
jobs:
deploy:

View File

@ -0,0 +1,46 @@
name: Setup Proxy for global-homepage.svc.plus
on:
workflow_dispatch:
workflow_call:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: 🚀 Configure Nginx on proxy host
uses: appleboy/ssh-action@v1.0.0
with:
host: ${{ secrets.GLOBAL_PROXY_HOST }}
username: ${{ secrets.GLOBAL_PROXY_HOST_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
apt-get update
apt-get install -y nginx
cat <<'NGINXCONF' > /etc/nginx/sites-available/default
# 1. HTTP 自动跳转到 HTTPS
server {
listen 80;
server_name global-homepage.svc.plus;
return 301 https://global-homepage.svc.plus$request_uri;
}
# 2. HTTPS 静态站部署
server {
listen 443 ssl http2;
server_name global-homepage.svc.plus;
ssl_certificate /etc/ssl/svc.plus.pem;
ssl_certificate_key /etc/ssl/svc.plus.rsa.key;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
root /var/www/XControl/ui/homepage/out;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
}
NGINXCONF
systemctl restart nginx