Skip to content

Commit b36e375

Browse files
committed
correct deploy
1 parent a117a8f commit b36e375

3 files changed

Lines changed: 18 additions & 6 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ on:
44
push:
55
branches: [ main ]
66

7+
# Environment variables for deployment configuration
8+
env:
9+
CUSTOM_DOMAIN: tools.akroter.io
10+
SUBDIRECTORY: bcf-viewer
11+
712
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
813
permissions:
914
contents: read
@@ -34,7 +39,10 @@ jobs:
3439
run: npm ci
3540

3641
- name: Build application
37-
run: npm run build
42+
run: npm run deploy
43+
44+
- name: Create CNAME file for custom domain
45+
run: echo "${{ env.CUSTOM_DOMAIN }}" > ./dist/CNAME
3846

3947
- name: Setup Pages
4048
uses: actions/configure-pages@v4

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22
"name": "bcf-viewer",
33
"version": "0.1.0",
44
"description": "A web application for viewing BCF files",
5-
"homepage": "https://akroter-io.github.io/bcf-viewer",
5+
"homepage": "https://tools.akroter.io/bcf-viewer",
66
"main": "dist/main.js",
77
"scripts": {
88
"build": "webpack --mode production",
9+
"build:custom-domain": "PUBLIC_PATH=/bcf-viewer/ webpack --mode production",
10+
"build:root": "PUBLIC_PATH=/ webpack --mode production",
911
"start": "webpack serve --mode development",
1012
"dev": "webpack --mode development --watch",
11-
"deploy": "npm run build"
13+
"deploy": "npm run build:custom-domain"
1214
},
1315
"keywords": [
1416
"BCF",

webpack.config.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,17 @@ const MiniCssExtractPlugin = require('mini-css-extract-plugin');
55

66
module.exports = (env, argv) => {
77
const isProduction = argv.mode === 'production';
8+
// Allow customization of public path via environment variable
9+
const publicPath = process.env.PUBLIC_PATH || (isProduction ? '/bcf-viewer/' : '/');
810

911
return {
1012
entry: './src/main.ts',
1113
output: {
1214
filename: 'bundle.js',
1315
path: path.resolve(__dirname, 'dist'),
1416
clean: true,
15-
// Set public path for GitHub Pages
16-
publicPath: isProduction ? '/bcf-viewer/' : '/',
17+
// Set public path - configurable via environment variable
18+
publicPath: publicPath,
1719
},
1820
resolve: {
1921
extensions: ['.ts', '.js'],
@@ -44,7 +46,7 @@ module.exports = (env, argv) => {
4446
filename: 'index.html',
4547
// Process favicon paths based on public path
4648
templateParameters: {
47-
publicPath: isProduction ? '/bcf-viewer/' : '/',
49+
publicPath: publicPath,
4850
},
4951
}),
5052
new CopyWebpackPlugin({

0 commit comments

Comments
 (0)