Change public path for GitHub pages

This commit is contained in:
c-bata
2023-08-30 15:24:39 +09:00
parent 70a142b613
commit ea849d9a93
2 changed files with 12 additions and 1 deletions
+7
View File
@@ -31,12 +31,19 @@ jobs:
with:
node-version: '18'
- name: Build standalone_app
env:
PUBLIC_PATH: /optuna-dashboard/public/
run: make MODE="prd" standalone_app/public/bundle.js
- name: Create publish directory
run: |
mkdir gh-publish
cp -r standalone_app/public gh-publish/public
cp standalone_app/favicon.ico gh-publish/favicon.ico
- name: Create index.html
run: |
cp standalone_app/index.html gh-publish/index.html
sed -i "s|/public/bundle.js|/optuna-dashboard/public/bundle.js|g" ./gh-publish/index.html
sed -i "s|/favicon.ico|/optuna-dashboard/favicon.ico|g" ./gh-publish/index.html
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
+5 -1
View File
@@ -3,6 +3,10 @@ const path = require('path');
const mode = process.env.NODE_ENV === 'production' ? 'production' : 'development';
const isDev = mode === 'development';
const PUBLIC_PATH = process.env.PUBLIC_PATH ?? '/public/';
if (!PUBLIC_PATH.endsWith('/')) {
PUBLIC_PATH += '/';
}
const typeScriptLoader = process.env.TYPESCRIPT_LOADER === "esbuild-loader" ? {
test: /\.tsx?$/,
@@ -34,7 +38,7 @@ var config = [
output: {
path: __dirname + '/public/',
filename: 'bundle.js',
publicPath: '/public/'
publicPath: PUBLIC_PATH
},
module: {
rules: [{ oneOf: [typeScriptLoader] }]