mirror of
https://github.com/XTLS/Xray-docs-next.git
synced 2025-03-03 13:43:15 +03:00
action: build for main repository
This commit is contained in:
parent
d98294791b
commit
d698965203
14
.github/workflows/build.yml
vendored
14
.github/workflows/build.yml
vendored
@ -25,6 +25,8 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-yarn-
|
${{ runner.os }}-yarn-
|
||||||
- name: Install and Build
|
- name: Install and Build
|
||||||
|
env:
|
||||||
|
XRAY_DOCS_USE_VITE: "true"
|
||||||
run: |
|
run: |
|
||||||
yarn install
|
yarn install
|
||||||
yarn docs:build
|
yarn docs:build
|
||||||
@ -33,3 +35,15 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
publish_dir: docs/.vuepress/dist
|
publish_dir: docs/.vuepress/dist
|
||||||
|
- name: Build for Main Repository
|
||||||
|
env:
|
||||||
|
XRAY_DOCS_MAIN_REPO: "true"
|
||||||
|
run: |
|
||||||
|
yarn docs:build
|
||||||
|
- name: Deploy to main Repository
|
||||||
|
uses: peaceiris/actions-gh-pages@v3
|
||||||
|
with:
|
||||||
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
publish_dir: docs/.vuepress/dist
|
||||||
|
external_repository: XTLS/XTLS.github.io
|
||||||
|
publish_branch: gh-pages-next
|
||||||
|
@ -5,6 +5,15 @@ import * as navbar from "./config/navbar";
|
|||||||
import * as path from "path";
|
import * as path from "path";
|
||||||
|
|
||||||
const isProduction = process.env.NODE_ENV === "production";
|
const isProduction = process.env.NODE_ENV === "production";
|
||||||
|
const forMainRepo = process.env.XRAY_DOCS_MAIN_REPO === "true";
|
||||||
|
const useVite = process.env.XRAY_DOCS_USE_VITE === "true";
|
||||||
|
|
||||||
|
console.log("environment: \n", process.env);
|
||||||
|
console.log("base:", forMainRepo ? "/" : "/Xray-docs-next/");
|
||||||
|
console.log(
|
||||||
|
"bundler:",
|
||||||
|
isProduction && !useVite ? "@vuepress/webpack" : "@vuepress/vite"
|
||||||
|
);
|
||||||
|
|
||||||
export default defineUserConfig<DefaultThemeOptions>({
|
export default defineUserConfig<DefaultThemeOptions>({
|
||||||
theme: path.join(__dirname, "./theme"),
|
theme: path.join(__dirname, "./theme"),
|
||||||
@ -21,7 +30,7 @@ export default defineUserConfig<DefaultThemeOptions>({
|
|||||||
],
|
],
|
||||||
["@vuepress/plugin-debug", !isProduction],
|
["@vuepress/plugin-debug", !isProduction],
|
||||||
],
|
],
|
||||||
base: "/Xray-docs-next/",
|
base: forMainRepo ? "/" : "/Xray-docs-next/",
|
||||||
locales: {
|
locales: {
|
||||||
"/": {
|
"/": {
|
||||||
lang: "zh-CN",
|
lang: "zh-CN",
|
||||||
@ -130,5 +139,5 @@ export default defineUserConfig<DefaultThemeOptions>({
|
|||||||
extendsMarkdown: (md) => {
|
extendsMarkdown: (md) => {
|
||||||
md.use(require("markdown-it-footnote"));
|
md.use(require("markdown-it-footnote"));
|
||||||
},
|
},
|
||||||
bundler: isProduction ? "@vuepress/webpack" : "@vuepress/vite",
|
bundler: isProduction && !useVite ? "@vuepress/webpack" : "@vuepress/vite",
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user