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: |
|
||||
${{ runner.os }}-yarn-
|
||||
- name: Install and Build
|
||||
env:
|
||||
XRAY_DOCS_USE_VITE: "true"
|
||||
run: |
|
||||
yarn install
|
||||
yarn docs:build
|
||||
@ -33,3 +35,15 @@ jobs:
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
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";
|
||||
|
||||
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>({
|
||||
theme: path.join(__dirname, "./theme"),
|
||||
@ -21,7 +30,7 @@ export default defineUserConfig<DefaultThemeOptions>({
|
||||
],
|
||||
["@vuepress/plugin-debug", !isProduction],
|
||||
],
|
||||
base: "/Xray-docs-next/",
|
||||
base: forMainRepo ? "/" : "/Xray-docs-next/",
|
||||
locales: {
|
||||
"/": {
|
||||
lang: "zh-CN",
|
||||
@ -130,5 +139,5 @@ export default defineUserConfig<DefaultThemeOptions>({
|
||||
extendsMarkdown: (md) => {
|
||||
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