diff --git a/.github/workflows/deploy-all.yml b/.github/workflows/deploy-all.yml new file mode 100644 index 0000000..79bef05 --- /dev/null +++ b/.github/workflows/deploy-all.yml @@ -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 diff --git a/.github/workflows/deploy-homepage.yml b/.github/workflows/deploy-homepage.yml index 3a68d20..bbde380 100644 --- a/.github/workflows/deploy-homepage.yml +++ b/.github/workflows/deploy-homepage.yml @@ -10,6 +10,7 @@ on: - 'ui/homepage/**' - '.github/workflows/deploy-homepage.yml' branches: [main] + workflow_call: jobs: deploy: diff --git a/.github/workflows/deploy-proxy-nginx.yml b/.github/workflows/deploy-proxy-nginx.yml index befb37f..5f41a25 100644 --- a/.github/workflows/deploy-proxy-nginx.yml +++ b/.github/workflows/deploy-proxy-nginx.yml @@ -2,6 +2,7 @@ name: Configure Proxy Nginx on: workflow_dispatch: + workflow_call: jobs: setup-nginx: diff --git a/.github/workflows/deploy-xcontrol-panel.yml b/.github/workflows/deploy-xcontrol-panel.yml index 375811f..09cb478 100644 --- a/.github/workflows/deploy-xcontrol-panel.yml +++ b/.github/workflows/deploy-xcontrol-panel.yml @@ -10,6 +10,7 @@ on: - 'ui/panel/**' - '.github/workflows/deploy-xcontrol-panel.yml' branches: [main] + workflow_call: jobs: deploy: diff --git a/.github/workflows/deploy-xcontrol-server.yml b/.github/workflows/deploy-xcontrol-server.yml new file mode 100644 index 0000000..995f861 --- /dev/null +++ b/.github/workflows/deploy-xcontrol-server.yml @@ -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..." diff --git a/.github/workflows/setup-proxy-cn-homepage.yml b/.github/workflows/setup-proxy-cn-homepage.yml index cd498f3..5394f6b 100644 --- a/.github/workflows/setup-proxy-cn-homepage.yml +++ b/.github/workflows/setup-proxy-cn-homepage.yml @@ -6,6 +6,7 @@ on: dummy: description: 'Manual trigger' required: false + workflow_call: jobs: deploy: diff --git a/.github/workflows/setup-proxy-global-homepage.yml b/.github/workflows/setup-proxy-global-homepage.yml new file mode 100644 index 0000000..2273471 --- /dev/null +++ b/.github/workflows/setup-proxy-global-homepage.yml @@ -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