diff --git a/.github/workflows/DANGEROUS_trigger_preview_pages.yml b/.github/workflows/DANGEROUS_trigger_preview_pages.yml new file mode 100644 index 0000000000..d61e7485ae --- /dev/null +++ b/.github/workflows/DANGEROUS_trigger_preview_pages.yml @@ -0,0 +1,26 @@ +name: "Trigger preview-pages' workflow" + +# プレビュー用ページのワークフローを起動する。 +# 詳細: https://github.com/voicevox/preview-pages?tab=readme-ov-file#%E4%BB%95%E7%B5%84%E3%81%BF + +on: + pull_request_target: + types: + - opened + - synchronize + - closed + - reopened + push: + branches: + - main + - project-* + +jobs: + trigger: + runs-on: ubuntu-latest + steps: + - name: Trigger Workflow + run: | + gh workflow run -R voicevox/preview-pages update_pages.yml + env: + GH_TOKEN: ${{ secrets.TRIGGER_PREVIEW_PAGES_TOKEN }} diff --git a/.github/workflows/build_preview_pages.yml b/.github/workflows/build_preview_pages.yml new file mode 100644 index 0000000000..f2e9a049af --- /dev/null +++ b/.github/workflows/build_preview_pages.yml @@ -0,0 +1,32 @@ +name: "Build Preview Pages" + +# プレビュー用ページをビルドする。 +# 詳細: https://github.com/voicevox/preview-pages?tab=readme-ov-file#%E4%BB%95%E7%B5%84%E3%81%BF + +on: + push: + branches: + - main + - project-* + pull_request: + +jobs: + update_pages: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup environment + uses: ./.github/actions/setup-environment + + - name: Build + run: | + npm run storybook:build -- --preview-url ./ --output-dir dist_preview/storybook + npm run browser:build -- --base ./ --outDir dist_preview/editor + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: preview-pages + path: dist_preview diff --git a/.gitignore b/.gitignore index 18efad1c2f..457a55735f 100644 --- a/.gitignore +++ b/.gitignore @@ -44,3 +44,6 @@ electron-builder.yml # Storybook storybook-static/ + +# Preview Build Output +dist_preview/ diff --git a/src/backend/browser/sandbox.ts b/src/backend/browser/sandbox.ts index 69552e8b7c..291bbdb1ef 100644 --- a/src/backend/browser/sandbox.ts +++ b/src/backend/browser/sandbox.ts @@ -19,8 +19,8 @@ import { } from "@/type/preload"; import { AssetTextFileNames } from "@/type/staticResources"; -// TODO: base pathを設定できるようにするか、ビルド時埋め込みにする -const toStaticPath = (fileName: string) => `/${fileName}`; +const toStaticPath = (fileName: string) => + `${import.meta.env.BASE_URL}/${fileName}`.replaceAll(/\/\/+/, "/"); // FIXME: asを使わないようオーバーロードにした。オーバーロードも使わない書き方にしたい。 function onReceivedIPCMsg<