Skip to content

Commit d73b625

Browse files
committed
refactor: reorganize deployment script for clarity and consistency in version injection
1 parent a4542b2 commit d73b625

1 file changed

Lines changed: 8 additions & 9 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,23 +47,22 @@ jobs:
4747
run: |
4848
mkdir -p _site
4949
cp -r main-content/* _site/ 2>/dev/null || true
50-
51-
sed -i 's|<span id="appVersion"[^>]*>[^<]*</span>|<span id="appVersion" class="text-sm text-slate-400">'"${RELEASE_VERSION}"'</span>|' _site/dev/index.html
52-
# Inject into JS constant
53-
sed -i 's|const APP_VERSION = "UNKNOWN";|const APP_VERSION = "DEV-'"${RELEASE_VERSION}"'";|' _site/dev/content/wardrive.js
5450
51+
# MAIN: inject release version into root site
52+
sed -i 's|<span id="appVersion"[^>]*>[^<]*</span>|<span id="appVersion" class="text-sm text-slate-400">'"${RELEASE_VERSION}"'</span>|' _site/index.html
53+
sed -i 's|const APP_VERSION = "UNKNOWN";|const APP_VERSION = "'"${RELEASE_VERSION}"'";|' _site/content/wardrive.js
54+
55+
# DEV: copy dev site under /dev
5556
mkdir -p _site/dev
5657
cp -r dev-content/* _site/dev/ 2>/dev/null || true
5758
cp -r dev-content/content _site/dev/ 2>/dev/null || true
58-
59-
# Inject DEV version (visual display) and JS constant with DEV-EPOCH format
59+
60+
# DEV: inject DEV-EPOCH
6061
DEV_EPOCH=$(date -u +%s)
61-
# Replace the visible version in the dedicated span (this is what the UI shows)
6262
sed -i 's|<span id="appVersion"[^>]*>[^<]*</span>|<span id="appVersion" class="text-sm text-slate-400">DEV-'"${DEV_EPOCH}"'</span>|' _site/dev/index.html
63-
# Inject into JS constant
6463
sed -i 's|const APP_VERSION = "UNKNOWN";|const APP_VERSION = "DEV-'"${DEV_EPOCH}"'";|' _site/dev/content/wardrive.js
6564
66-
find _site -name ". git" -exec rm -rf {} + 2>/dev/null || true
65+
find _site -name ".git" -exec rm -rf {} + 2>/dev/null || true
6766
find _site -name ".github" -exec rm -rf {} + 2>/dev/null || true
6867
6968
- name: Upload artifact

0 commit comments

Comments
 (0)