From bcb395da5ef1c798626d0138ccfd9f95e61fac9a Mon Sep 17 00:00:00 2001 From: 0song <82012629+0song@users.noreply.github.com> Date: Tue, 16 Sep 2025 20:25:46 +0800 Subject: [PATCH] chore: update deploy logic (#22189) chore: update deploy --- .../workflows/publish-docs-deploy-manual.yml | 15 +++++++---- .github/workflows/publish-docs-deploy.yml | 15 +++++++---- docs/.vitepress/config/head.ts | 14 ----------- docs/.vitepress/lang.js | 25 ------------------- 4 files changed, 20 insertions(+), 49 deletions(-) delete mode 100644 docs/.vitepress/lang.js diff --git a/.github/workflows/publish-docs-deploy-manual.yml b/.github/workflows/publish-docs-deploy-manual.yml index ba63089a48..93b1743cb6 100644 --- a/.github/workflows/publish-docs-deploy-manual.yml +++ b/.github/workflows/publish-docs-deploy-manual.yml @@ -69,7 +69,7 @@ jobs: git-config-email: element-plus@outlook.com commit-message: website deploy - - name: Deploy to vercel + - name: Deploy to Vercel uses: JamesIves/github-pages-deploy-action@v4.4.1 with: token: ${{ secrets.EP_BOT_TOKEN }} @@ -79,7 +79,12 @@ jobs: git-config-name: ElementPlusBot git-config-email: element-plus@outlook.com - - name: Sync - env: - TRIGGERSYNCURL: ${{ secrets.TRIGGERSYNCURL }} - run: curl -k "$TRIGGERSYNCURL" + - name: Deploy to Vercel Main + uses: JamesIves/github-pages-deploy-action@v4.4.1 + with: + token: ${{ secrets.EP_BOT_TOKEN }} + branch: main + folder: docs/.vitepress/dist + repository-name: element-plus/vercel-publish-main + git-config-name: ElementPlusBot + git-config-email: element-plus@outlook.com diff --git a/.github/workflows/publish-docs-deploy.yml b/.github/workflows/publish-docs-deploy.yml index 57ad3ff9a3..123ef76d0d 100644 --- a/.github/workflows/publish-docs-deploy.yml +++ b/.github/workflows/publish-docs-deploy.yml @@ -76,7 +76,7 @@ jobs: git-config-email: element-plus@outlook.com commit-message: website deploy - - name: Deploy to vercel + - name: Deploy to Vercel uses: JamesIves/github-pages-deploy-action@v4.4.1 with: token: ${{ secrets.EP_BOT_TOKEN }} @@ -86,7 +86,12 @@ jobs: git-config-name: ElementPlusBot git-config-email: element-plus@outlook.com - - name: Sync - env: - TRIGGERSYNCURL: ${{ secrets.TRIGGERSYNCURL }} - run: curl -k "$TRIGGERSYNCURL" + - name: Deploy to Vercel Main + uses: JamesIves/github-pages-deploy-action@v4.4.1 + with: + token: ${{ secrets.EP_BOT_TOKEN }} + branch: main + folder: docs/.vitepress/dist + repository-name: element-plus/vercel-publish-main + git-config-name: ElementPlusBot + git-config-email: element-plus@outlook.com diff --git a/docs/.vitepress/config/head.ts b/docs/.vitepress/config/head.ts index 2610fe1416..dd51a7f7ed 100644 --- a/docs/.vitepress/config/head.ts +++ b/docs/.vitepress/config/head.ts @@ -1,8 +1,3 @@ -import fs from 'fs' -import path from 'path' -import { vpRoot } from '@element-plus/build-utils' -import { languages } from '../utils/lang' - import type { HeadConfig } from 'vitepress' export const head: HeadConfig[] = [ @@ -49,15 +44,6 @@ export const head: HeadConfig[] = [ content: 'codeva-q5gBxYcfOs', }, ], - [ - 'script', - {}, - `;(() => { - window.supportedLangs = ${JSON.stringify(languages)} - })()`, - ], - - ['script', {}, fs.readFileSync(path.resolve(vpRoot, 'lang.js'), 'utf-8')], [ 'script', { diff --git a/docs/.vitepress/lang.js b/docs/.vitepress/lang.js deleted file mode 100644 index 2c14f832e3..0000000000 --- a/docs/.vitepress/lang.js +++ /dev/null @@ -1,25 +0,0 @@ -;(() => { - const supportedLangs = window.supportedLangs - const cacheKey = 'preferred_lang' - const defaultLang = 'en-US' - const handleNavigatorLang = (navLang) => { - const { language, region } = new Intl.Locale(navLang).maximize() - return `${language}-${region}` - } - let userPreferredLang = - localStorage.getItem(cacheKey) || handleNavigatorLang(navigator.language) - const language = supportedLangs.includes(userPreferredLang) - ? userPreferredLang - : defaultLang - localStorage.setItem(cacheKey, language) - userPreferredLang = language - if (!location.pathname.startsWith(`/${userPreferredLang}`)) { - const toPath = [`/${userPreferredLang}`] - .concat(location.pathname.split('/').slice(2)) - .join('/') - location.pathname = - toPath.endsWith('.html') || toPath.endsWith('/') - ? toPath - : toPath.concat('/') - } -})()