From 3519a26495df4c7b4abc37eb04776f9719688d92 Mon Sep 17 00:00:00 2001 From: xyzm Date: Tue, 10 Feb 2026 20:17:26 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E5=88=A0=E9=99=A4=E5=B7=B2=E5=BC=83?= =?UTF-8?q?=E7=94=A8=E7=9A=84=E9=83=A8=E7=BD=B2=E5=B7=A5=E4=BD=9C=E6=B5=81?= =?UTF-8?q?=E5=B9=B6=E6=9B=B4=E6=96=B0=E7=94=9F=E4=BA=A7=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E6=A3=80=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 删除三个已弃用的 GitHub Actions 工作流文件 (deploy_docs_pages.yml, demo_site_deploy.yml, custom_deploy.yml),这些工作流已不再使用。 同时更新 web/config.js 中的生产环境检测逻辑,使其同时识别 'prod' 和 'production' 环境变量值,提高配置的灵活性。 --- .github/workflows/custom_deploy.yml | 69 ------------------------- .github/workflows/demo_site_deploy.yml | 69 ------------------------- .github/workflows/deploy_docs_pages.yml | 66 ----------------------- web/config.js | 2 +- 4 files changed, 1 insertion(+), 205 deletions(-) delete mode 100644 .github/workflows/custom_deploy.yml delete mode 100644 .github/workflows/demo_site_deploy.yml delete mode 100644 .github/workflows/deploy_docs_pages.yml diff --git a/.github/workflows/custom_deploy.yml b/.github/workflows/custom_deploy.yml deleted file mode 100644 index 0464e48..0000000 --- a/.github/workflows/custom_deploy.yml +++ /dev/null @@ -1,69 +0,0 @@ -name: custom-deploy-your-server - - -on: - workflow_dispatch: - push: - branches: [ "main" ] - -jobs: - build-deploy: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - - name: Set up Node.js - uses: actions/setup-node@v4 - with: - node-version: "20.x" - - - name: Set up Golang - uses: actions/setup-go@v5 - with: - go-version: "1.24" - - - name: Install npm dependencies - run: npm ci - working-directory: web/ - - - name: Run npm build - run: echo "BUILD_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ")" >> $GITHUB_ENV && export NODE_ENV=prod && npm run build - working-directory: web/ - - - name: Check build static - run: ls dist/ -la - working-directory: web/ - - - name: Get Release version - id: get_version - run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT - - - name: Update Local Version File - run: echo ${{ steps.get_version.outputs.VERSION }} > .release_version - - - name: Install Go modules - run: go mod tidy - - - name: Build Go - run: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o Message-Nest - - - name: Copy files to server - uses: appleboy/scp-action@master - with: - host: ${{ secrets.SERVER_HOST }} - port: ${{ secrets.SERVER_PORT }} - username: ${{ secrets.SERVER_USERNAME }} - password: ${{ secrets.SERVER_PASSWD }} - source: "Message-Nest" - target: ${{ secrets.REMOTE_TARGER }} - - - name: SSH into server and restart service - uses: appleboy/ssh-action@master - with: - host: ${{ secrets.SERVER_HOST }} - port: ${{ secrets.SERVER_PORT }} - username: ${{ secrets.SERVER_USERNAME }} - password: ${{ secrets.SERVER_PASSWD }} - script: | - ${{ secrets.REMOTE_SCRIPT }} diff --git a/.github/workflows/demo_site_deploy.yml b/.github/workflows/demo_site_deploy.yml deleted file mode 100644 index fdd8f0c..0000000 --- a/.github/workflows/demo_site_deploy.yml +++ /dev/null @@ -1,69 +0,0 @@ -name: deploy-demo-site - - -on: - workflow_dispatch: - push: - branches: [ "main" ] - -jobs: - build-deploy: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - - name: Set up Node.js - uses: actions/setup-node@v4 - with: - node-version: "20.x" - - - name: Set up Golang - uses: actions/setup-go@v5 - with: - go-version: "1.24" - - - name: Install npm dependencies - run: npm ci - working-directory: web/ - - - name: Run npm build - run: export NODE_ENV=prod && npm run build:demo - working-directory: web/ - - - name: Check build static - run: ls dist/ -la - working-directory: web/ - - - name: Get Release version - id: get_version - run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT - - - name: Update Local Version File - run: echo ${{ steps.get_version.outputs.VERSION }} > .release_version - - - name: Install Go modules - run: go mod tidy - - - name: Build Go - run: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o Message-Nest - - - name: Copy files to server - uses: appleboy/scp-action@master - with: - host: ${{ secrets.SERVER_HOST }} - port: ${{ secrets.SERVER_PORT }} - username: ${{ secrets.SERVER_USERNAME }} - password: ${{ secrets.SERVER_PASSWD }} - source: "Message-Nest" - target: ${{ secrets.REMOTE_DEMO_TARGET }} - - - name: SSH into server and restart service - uses: appleboy/ssh-action@master - with: - host: ${{ secrets.SERVER_HOST }} - port: ${{ secrets.SERVER_PORT }} - username: ${{ secrets.SERVER_USERNAME }} - password: ${{ secrets.SERVER_PASSWD }} - script: | - ${{ secrets.REMOTE_DEMO_SCRIPT }} diff --git a/.github/workflows/deploy_docs_pages.yml b/.github/workflows/deploy_docs_pages.yml deleted file mode 100644 index 528c79d..0000000 --- a/.github/workflows/deploy_docs_pages.yml +++ /dev/null @@ -1,66 +0,0 @@ -name: Deploy Docs to GitHub Pages - -on: - # 在推送到 main 分支时触发 - push: - branches: - - main - # 允许手动触发 - workflow_dispatch: - -# 设置 GITHUB_TOKEN 的权限,允许部署到 GitHub Pages -permissions: - contents: read - pages: write - id-token: write - -# 只允许一个并发部署 -concurrency: - group: pages - cancel-in-progress: false - -jobs: - # 构建任务 - build: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 # 如果未启用 lastUpdated,则不需要 - - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: 20 - cache: npm - cache-dependency-path: docs/package-lock.json - - - name: Setup Pages - uses: actions/configure-pages@v4 - - - name: Install dependencies - run: npm ci - working-directory: docs - - - name: Build with VitePress - run: npm run docs:build - working-directory: docs - - - name: Upload artifact - uses: actions/upload-pages-artifact@v3 - with: - path: docs/.vitepress/dist - - # 部署任务 - deploy: - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - needs: build - runs-on: ubuntu-latest - name: Deploy - steps: - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v4 diff --git a/web/config.js b/web/config.js index 31c63ac..9facad0 100644 --- a/web/config.js +++ b/web/config.js @@ -1,6 +1,6 @@ // config.js -const isProduction = process.env.NODE_ENV === 'prod'; +const isProduction = process.env.NODE_ENV === 'prod' || process.env.NODE_ENV === 'production'; // 从 window 对象获取路径前缀(由后端注入或通过 API 获取) const getPathPrefix = () => {