-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (65 loc) · 2.79 KB
/
deploy.yml
File metadata and controls
81 lines (65 loc) · 2.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: Deploy to GitHub Pages
on:
push:
branches:
- main
- dev
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
build-and-deploy:
runs-on: ubuntu-latest
#runs-on: self-hosted
steps:
- name: Checkout main branch
uses: actions/checkout@v4
with:
ref: main
path: main-content
- name: Checkout dev branch
uses: actions/checkout@v4
with:
ref: dev
path: dev-content
- name: Get latest release version
id: get_release
run: |
RELEASE_TAG=$(curl -s https://api.github.com/repos/MeshMapper/MeshMapper_WebClient/releases/latest | jq -r '.tag_name')
echo "version=$RELEASE_TAG" >> $GITHUB_OUTPUT
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Prepare combined deployment
env:
RELEASE_VERSION: ${{ steps.get_release. outputs.version }}
run: |
mkdir -p _site
cp -r main-content/* _site/ 2>/dev/null || true
# MAIN: inject release version into root site
sed -i 's|<span id="appVersion"[^>]*>[^<]*</span>|<span id="appVersion" class="text-xs bg-slate-800 border border-slate-700 px-3 py-1 rounded-full text-slate-400 flex-shrink-0">'"${RELEASE_VERSION}"'</span>|' _site/index.html
sed -i 's|const APP_VERSION = "UNKNOWN";|const APP_VERSION = "'"${RELEASE_VERSION}"'";|' _site/content/wardrive.js
# DEV: copy dev site under /dev
mkdir -p _site/dev
cp -r dev-content/* _site/dev/ 2>/dev/null || true
cp -r dev-content/content _site/dev/ 2>/dev/null || true
# DEV: inject DEV-EPOCH
DEV_EPOCH=$(date -u +%s)
sed -i 's|<span id="appVersion"[^>]*>[^<]*</span>|<span id="appVersion" class="text-xs bg-slate-800 border border-slate-700 px-3 py-1 rounded-full text-slate-400 flex-shrink-0">DEV-'"${DEV_EPOCH}"'</span>|' _site/dev/index.html
sed -i 's|const APP_VERSION = "UNKNOWN";|const APP_VERSION = "DEV-'"${DEV_EPOCH}"'";|' _site/dev/content/wardrive.js
find _site -name ".git" -exec rm -rf {} + 2>/dev/null || true
find _site -name ".github" -exec rm -rf {} + 2>/dev/null || true
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
- name: Comment deployment URL
run: |
echo "✅ Deployed successfully!"
echo "📦 Main branch (${{ steps.get_release.outputs.version }}): https://mralders0n.github.io/MeshCore-GOME-WarDriver/"
echo "🔧 Dev branch: https://mralders0n.github.io/MeshCore-GOME-WarDriver/dev/"