Skip to content

Commit fd2d853

Browse files
committed
Refactor deployment base path in GitHub Actions workflow to use repository name and remove obsolete build scripts for versioned deployments
1 parent f9c222c commit fd2d853

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

.github/workflows/static.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,14 @@ jobs:
5959
- name: Build
6060
env:
6161
BASE_PATH: ${{ steps.vars.outputs.subpath }}
62-
APP_BASE: browserstack-demo-app
6362
run: |
6463
# Compute a single deploy base that always ends with a trailing slash
64+
# Use repository name as base (strip organization and .git if present)
65+
REPO_NAME=$(basename -s .git "${GITHUB_REPOSITORY}")
6566
if [ -n "$BASE_PATH" ]; then
66-
DEPLOY_BASE="/${APP_BASE}/${BASE_PATH}/"
67+
DEPLOY_BASE="/${REPO_NAME}/${BASE_PATH}/"
6768
else
68-
DEPLOY_BASE="/${APP_BASE}/"
69+
DEPLOY_BASE="/${REPO_NAME}/"
6970
fi
7071
7172
# Export to the build-tool env names expected by the project
@@ -128,13 +129,14 @@ jobs:
128129
- name: Build
129130
env:
130131
BASE_PATH: ${{ steps.vars.outputs.subpath }}
131-
APP_BASE: browserstack-demo-app
132132
run: |
133133
# Compute a single deploy base that always ends with a trailing slash
134+
# Use repository name as base (strip organization and .git if present)
135+
REPO_NAME=$(basename -s .git "${GITHUB_REPOSITORY}")
134136
if [ -n "$BASE_PATH" ]; then
135-
DEPLOY_BASE="/${APP_BASE}/${BASE_PATH}/"
137+
DEPLOY_BASE="/${REPO_NAME}/${BASE_PATH}/"
136138
else
137-
DEPLOY_BASE="/${APP_BASE}/"
139+
DEPLOY_BASE="/${REPO_NAME}/"
138140
fi
139141
140142
# Export to the build-tool env names expected by the project

package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@
99
"dev": "vite",
1010
"build": "vite build",
1111
"build:dev": "vite build --mode development",
12-
"build:v1": "cross-env VITE_BASE_PATH=/browserstack-demo-app/v1/ vite build",
13-
"build:v2": "cross-env VITE_BASE_PATH=/browserstack-demo-app/v2/ vite build",
14-
"build:v3": "cross-env VITE_BASE_PATH=/browserstack-demo-app/v3/ vite build",
1512
"lint": "eslint .",
1613
"preview": "vite preview"
1714
},

0 commit comments

Comments
 (0)