From 02a70f8de7e22a7fbc033a9ef42e38fe6eaff81c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9C=E6=9D=8E=E4=BB=95=E8=93=AC=E2=80=9D?= <“lishipeng3@gemdale.com”> Date: Wed, 16 Nov 2022 14:35:24 +0800 Subject: [PATCH] fix:homepage and update ci --- .github/workflows/ci.yaml | 12 +++--------- package.json | 1 + public/config.json | 2 +- src/App.tsx | 2 +- src/index.tsx | 2 +- src/pages/demo/index.tsx | 2 +- 6 files changed, 8 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a9620b7..fae80e2 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -11,7 +11,6 @@ on: jobs: # job id: 是 job 的唯一标识 build_and_deploy: - # 在 Github 中显示的 job 名称 name: Build and Deploy # job 运行的环境配置 runs-on: ubuntu-latest @@ -36,26 +35,21 @@ jobs: restore-keys: | ${{ runner.os }}-node- - name: Use Node.js - # 配置 Node 执行环境(当前构建的服务器默认没有 Node 环境,可以通过 Action 安装 Node) - # https://github.com/actions/setup-node uses: actions/setup-node@v1 with: - node-version: 14 + node-version: 16 - name: Build - # 安装 Node 之后就可以执行构建脚本 run: | npm install yarn -g yarn yarn build - name: Deploy - # 将构建产物 commit 到一个分支上,用于发布静态站点资源 - # https://github.com/peaceiris/actions-gh-pages uses: peaceiris/actions-gh-pages@v3 with: # Github 会在 workflow 中自动生成 GIHUBT_TOKEN,用于认证 workflow 的运行 - github_token: ${{ secrets.GITHUB_TOKEN }} + github_token: ${{ secrets.ACCESS_TOKEN }} # 静态资源目录设置 publish_dir: ./build # 默认发布到 gh-pages 分支上,可以指定特定的发布分支(不能选拉取代码的分支) publish_branch: gh-pages - full_commit_message: ${{ github.event.head_commit.message }} \ No newline at end of file + full_commit_message: ${{ github.event.head_commit.message }} diff --git a/package.json b/package.json index 12f2e0e..abf1d58 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,7 @@ "name": "gemini-viewer-demo", "version": "0.1.0", "private": true, + "homepage": "/gemini-viewer-examples/", "dependencies": { "@codemirror/autocomplete": "^6.3.0", "@codemirror/commands": "^6.1.2", diff --git a/public/config.json b/public/config.json index 990887e..2d7789a 100644 --- a/public/config.json +++ b/public/config.json @@ -14,7 +14,7 @@ "title": "图纸", "subMenus": [{ "title": "本地图纸加载", - "url": "../demo/empty_dxf_project.html" + "url": "./demo/empty_dxf_project.html" }, { "title": "Rac basic sample project", "url": "./demo/dxf_0.html" diff --git a/src/App.tsx b/src/App.tsx index 4c35069..8211991 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,7 +1,7 @@ import './App.css' import { FC } from 'react'; import { RecoilRoot } from "recoil"; -import { Routes, Route } from "react-router-dom"; +import { Routes, Route } from 'react-router-dom'; import Demo from './pages/demo'; const App: FC = () => { diff --git a/src/index.tsx b/src/index.tsx index 2c7ffbc..1daa22a 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -10,7 +10,7 @@ const root = ReactDOM.createRoot( ); root.render( - + diff --git a/src/pages/demo/index.tsx b/src/pages/demo/index.tsx index e74b9f3..f25c859 100644 --- a/src/pages/demo/index.tsx +++ b/src/pages/demo/index.tsx @@ -8,7 +8,7 @@ function Demo() { const [data, setData] = useState([]); useEffect(() => { - fetch("../config.json").then(data => data.json()).then((data) => { + fetch("../gemini-viewer-examples/config.json").then(data => data.json()).then((data) => { setData(data); }); }, [])