Merge pull request #95 from MrAlders0n/copilot/refactor-ui-progressiv… #131
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | |
| 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/MrAlders0n/MeshCore-GOME-WarDriver/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 | |
| # Inject version into main branch (visual display and JS constant) | |
| sed -i 's|MeshCore Wardrive</h1>|MeshCore Wardrive <span class="text-sm text-slate-400">'"${RELEASE_VERSION}"'</span></h1>|' _site/index.html | |
| sed -i 's|const APP_VERSION = "UNKNOWN";|const APP_VERSION = "'"${RELEASE_VERSION}"'";|' _site/content/wardrive.js | |
| 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 | |
| # Inject dev badge with date (visual display and JS constant with DEV-EPOCH format) | |
| DEV_DATE=$(date -u +"%Y-%m-%d %H:%M UTC") | |
| DEV_EPOCH=$(date -u +%s) | |
| sed -i 's|MeshCore Wardrive</h1>|MeshCore Wardrive <span class="ml-2 px-2 py-0.5 text-xs font-semibold rounded bg-amber-600/20 text-amber-400 border border-amber-600/40">DEV</span> <span class="text-xs text-slate-500">'"${DEV_DATE}"'</span></h1>|' _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/" |