Skip to content

Commit

Permalink
Add: プレビュー版のタイトルバーにコミットハッシュを入れる (#2349)
Browse files Browse the repository at this point in the history
Co-authored-by: Hiroshiba <[email protected]>
  • Loading branch information
sevenc-nanashi and Hiroshiba authored Nov 9, 2024
1 parent 4689cf8 commit 301f792
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
15 changes: 14 additions & 1 deletion .github/workflows/build_preview_pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,21 @@ jobs:

- name: Build
run: |
# 追加のバージョン情報
if [ -n "${{ github.event.pull_request.head.sha }}" ]; then
LOCATION="PR#${{ github.event.pull_request.number }}"
SHORT_SHA=$(cut -c 1-7 <<< "${{ github.event.pull_request.head.sha }}")
else
LOCATION="${{ github.ref_name }}"
SHORT_SHA=$(cut -c 1-7 <<< "${{ github.sha }}")
fi
# Storybookのビルド
npm run storybook:build -- --output-dir $(pwd)/dist_preview/storybook
npm run browser:build -- --base ./ --outDir $(pwd)/dist_preview/editor
# ブラウザ版エディタのビルド
VITE_EXTRA_VERSION_INFO="${LOCATION} @ ${SHORT_SHA}" \
npm run browser:build -- --base ./ --outDir $(pwd)/dist_preview/editor
- name: Upload artifact
uses: actions/upload-artifact@v4
Expand Down
4 changes: 4 additions & 0 deletions src/components/Menu/MenuBar/MenuBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ const store = useStore();
const { registerHotkeyWithCleanup } = useHotkeyManager();
const currentVersion = ref("");
/** 追加のバージョン情報。コミットハッシュなどを書ける。 */
const extraVersionInfo = import.meta.env.VITE_EXTRA_VERSION_INFO;
const audioKeys = computed(() => store.state.audioKeys);
// デフォルトエンジンの代替先ポート
Expand Down Expand Up @@ -93,6 +96,7 @@ const titleText = computed(
(projectName.value != undefined ? projectName.value + " - " : "") +
"VOICEVOX" +
(currentVersion.value ? " - Ver. " + currentVersion.value : "") +
(extraVersionInfo ? ` (${extraVersionInfo})` : "") +
(isMultiEngineOffMode.value ? " - マルチエンジンオフ" : "") +
(defaultEngineAltPortTo.value != null
? ` - Port: ${defaultEngineAltPortTo.value}`
Expand Down
1 change: 1 addition & 0 deletions src/vite-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ interface ImportMetaEnv {
readonly VITE_LATEST_UPDATE_INFOS_URL: string;
readonly VITE_GTM_CONTAINER_ID: string;
readonly VITE_TARGET: "electron" | "browser";
readonly VITE_EXTRA_VERSION_INFO: string | undefined;
}

interface ImportMeta {
Expand Down

0 comments on commit 301f792

Please sign in to comment.