From 7b08766bb843bc8c56c255eef8224d3ac5178c55 Mon Sep 17 00:00:00 2001 From: sevenc-nanashi Date: Tue, 5 Nov 2024 20:17:23 +0900 Subject: [PATCH 1/8] =?UTF-8?q?Add:=20preview=5Fpages=E7=94=A8=E3=81=AEWor?= =?UTF-8?q?kflow=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/trigger_preview.yml | 22 +++++++++++++++++++ .github/workflows/update_preview.yml | 31 +++++++++++++++++++++++++++ .gitignore | 3 +++ 3 files changed, 56 insertions(+) create mode 100644 .github/workflows/trigger_preview.yml create mode 100644 .github/workflows/update_preview.yml diff --git a/.github/workflows/trigger_preview.yml b/.github/workflows/trigger_preview.yml new file mode 100644 index 0000000000..c80d61f88f --- /dev/null +++ b/.github/workflows/trigger_preview.yml @@ -0,0 +1,22 @@ +name: "Trigger Preview Update" + +on: + pull_request_target: + types: + - opened + - synchronize + - closed + - reopened + push: + branches: + - main + +jobs: + trigger: + runs-on: ubuntu-latest + steps: + - name: Trigger Bot + run: | + gh workflow run -R voicevox/pages-preview update_pages.yml + env: + GH_TOKEN: ${{ secrets.PREVIEW_UPDATE_TOKEN }} diff --git a/.github/workflows/update_preview.yml b/.github/workflows/update_preview.yml new file mode 100644 index 0000000000..d581625c47 --- /dev/null +++ b/.github/workflows/update_preview.yml @@ -0,0 +1,31 @@ +name: "Build Preview" +on: + push: + 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 ./ + npm run browser:build -- --base ./ + + mkdir dist_preview + mkdir dist_preview/editor + mkdir dist_preview/storybook + cp -r dist/* dist_preview/editor/ + cp -r storybook-static/* dist_preview/storybook/ + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: preview-page + path: dist 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/ From 44baae75f8d2aaddebc1fef4f3715dd9a48e0bae Mon Sep 17 00:00:00 2001 From: sevenc-nanashi Date: Tue, 5 Nov 2024 20:18:09 +0900 Subject: [PATCH 2/8] =?UTF-8?q?Fix:=20=E3=83=96=E3=83=A9=E3=83=B3=E3=83=81?= =?UTF-8?q?=E6=8C=87=E5=AE=9A=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/trigger_preview.yml | 1 + .github/workflows/update_preview.yml | 3 +++ 2 files changed, 4 insertions(+) diff --git a/.github/workflows/trigger_preview.yml b/.github/workflows/trigger_preview.yml index c80d61f88f..686181634e 100644 --- a/.github/workflows/trigger_preview.yml +++ b/.github/workflows/trigger_preview.yml @@ -10,6 +10,7 @@ on: push: branches: - main + - project-* jobs: trigger: diff --git a/.github/workflows/update_preview.yml b/.github/workflows/update_preview.yml index d581625c47..abf549a28a 100644 --- a/.github/workflows/update_preview.yml +++ b/.github/workflows/update_preview.yml @@ -1,6 +1,9 @@ name: "Build Preview" on: push: + branches: + - main + - project-* pull_request: jobs: From 495ed0d12a24374340560501b53a0af81ffa7485 Mon Sep 17 00:00:00 2001 From: sevenc-nanashi Date: Tue, 5 Nov 2024 20:19:27 +0900 Subject: [PATCH 3/8] =?UTF-8?q?Fix:=20=E3=83=AA=E3=83=9D=E5=90=8D=E3=82=92?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/trigger_preview.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/trigger_preview.yml b/.github/workflows/trigger_preview.yml index 686181634e..1b48f5711c 100644 --- a/.github/workflows/trigger_preview.yml +++ b/.github/workflows/trigger_preview.yml @@ -18,6 +18,6 @@ jobs: steps: - name: Trigger Bot run: | - gh workflow run -R voicevox/pages-preview update_pages.yml + gh workflow run -R voicevox/preview-pages update_pages.yml env: GH_TOKEN: ${{ secrets.PREVIEW_UPDATE_TOKEN }} From f0a93604f192cfa5b7d5b7524eafb1a6021dc2e6 Mon Sep 17 00:00:00 2001 From: "Nanashi." Date: Wed, 6 Nov 2024 00:42:53 +0900 Subject: [PATCH 4/8] =?UTF-8?q?Fix:=20=E3=83=91=E3=82=B9=E3=82=92=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/update_preview.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update_preview.yml b/.github/workflows/update_preview.yml index abf549a28a..d33bf842ec 100644 --- a/.github/workflows/update_preview.yml +++ b/.github/workflows/update_preview.yml @@ -31,4 +31,4 @@ jobs: uses: actions/upload-artifact@v4 with: name: preview-page - path: dist + path: dist_preview From 44461004d4c1ad7e84832c984ce0b28074dc2b17 Mon Sep 17 00:00:00 2001 From: sevenc-nanashi Date: Wed, 6 Nov 2024 01:01:44 +0900 Subject: [PATCH 5/8] =?UTF-8?q?Improve:=20=E3=83=AC=E3=83=93=E3=83=A5?= =?UTF-8?q?=E3=83=BC=E3=82=92=E5=8F=8D=E6=98=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...yml => DANGEROUS_trigger_preview_pages.yml} | 6 +++--- ...ate_preview.yml => build_preview_pages.yml} | 18 ++++++++---------- 2 files changed, 11 insertions(+), 13 deletions(-) rename .github/workflows/{trigger_preview.yml => DANGEROUS_trigger_preview_pages.yml} (69%) rename .github/workflows/{update_preview.yml => build_preview_pages.yml} (53%) diff --git a/.github/workflows/trigger_preview.yml b/.github/workflows/DANGEROUS_trigger_preview_pages.yml similarity index 69% rename from .github/workflows/trigger_preview.yml rename to .github/workflows/DANGEROUS_trigger_preview_pages.yml index 1b48f5711c..975f7f0411 100644 --- a/.github/workflows/trigger_preview.yml +++ b/.github/workflows/DANGEROUS_trigger_preview_pages.yml @@ -1,4 +1,4 @@ -name: "Trigger Preview Update" +name: "Trigger preview-pages' workflow" on: pull_request_target: @@ -16,8 +16,8 @@ jobs: trigger: runs-on: ubuntu-latest steps: - - name: Trigger Bot + - name: Trigger Workflow run: | gh workflow run -R voicevox/preview-pages update_pages.yml env: - GH_TOKEN: ${{ secrets.PREVIEW_UPDATE_TOKEN }} + GH_TOKEN: ${{ secrets.TRIGGER_PREVIEW_PAGES_TOKEN }} diff --git a/.github/workflows/update_preview.yml b/.github/workflows/build_preview_pages.yml similarity index 53% rename from .github/workflows/update_preview.yml rename to .github/workflows/build_preview_pages.yml index d33bf842ec..f2e9a049af 100644 --- a/.github/workflows/update_preview.yml +++ b/.github/workflows/build_preview_pages.yml @@ -1,4 +1,8 @@ -name: "Build Preview" +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: @@ -18,17 +22,11 @@ jobs: - name: Build run: | - npm run storybook:build -- --preview-url ./ - npm run browser:build -- --base ./ - - mkdir dist_preview - mkdir dist_preview/editor - mkdir dist_preview/storybook - cp -r dist/* dist_preview/editor/ - cp -r storybook-static/* dist_preview/storybook/ + 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-page + name: preview-pages path: dist_preview From 9bf16996f2cf324b4b0b7e58b309521d98842bfa Mon Sep 17 00:00:00 2001 From: "Nanashi." Date: Wed, 6 Nov 2024 06:25:09 +0900 Subject: [PATCH 6/8] =?UTF-8?q?Code:=20=E3=82=B3=E3=83=A1=E3=83=B3?= =?UTF-8?q?=E3=83=88=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Hiroshiba --- .github/workflows/DANGEROUS_trigger_preview_pages.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/DANGEROUS_trigger_preview_pages.yml b/.github/workflows/DANGEROUS_trigger_preview_pages.yml index 975f7f0411..d61e7485ae 100644 --- a/.github/workflows/DANGEROUS_trigger_preview_pages.yml +++ b/.github/workflows/DANGEROUS_trigger_preview_pages.yml @@ -1,5 +1,8 @@ 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: From b2512ee3c817976e662e4258165f28a42a1c3332 Mon Sep 17 00:00:00 2001 From: "Nanashi." Date: Wed, 6 Nov 2024 07:16:29 +0900 Subject: [PATCH 7/8] =?UTF-8?q?Fix:=20toBaseUrl=E3=82=92BASE=5FURL?= =?UTF-8?q?=E3=82=92=E8=A6=8B=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/browser/sandbox.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/backend/browser/sandbox.ts b/src/backend/browser/sandbox.ts index 69552e8b7c..ec00050c02 100644 --- a/src/backend/browser/sandbox.ts +++ b/src/backend/browser/sandbox.ts @@ -20,7 +20,8 @@ import { 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< From d843778b345447f364daf60aa0f8c2a357e87f94 Mon Sep 17 00:00:00 2001 From: "Nanashi." Date: Wed, 6 Nov 2024 15:30:28 +0900 Subject: [PATCH 8/8] =?UTF-8?q?Delete:=20TOOD=E3=82=B3=E3=83=A1=E3=83=B3?= =?UTF-8?q?=E3=83=88=E3=82=92=E6=B6=88=E3=81=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/browser/sandbox.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/backend/browser/sandbox.ts b/src/backend/browser/sandbox.ts index ec00050c02..291bbdb1ef 100644 --- a/src/backend/browser/sandbox.ts +++ b/src/backend/browser/sandbox.ts @@ -19,7 +19,6 @@ import { } from "@/type/preload"; import { AssetTextFileNames } from "@/type/staticResources"; -// TODO: base pathを設定できるようにするか、ビルド時埋め込みにする const toStaticPath = (fileName: string) => `${import.meta.env.BASE_URL}/${fileName}`.replaceAll(/\/\/+/, "/");