Merge pull request #153 from MrAlders0n/copilot/fix-zone-status-error… #230
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 | |
| # MAIN: inject release version into root site | |
| sed -i 's|<span id="appVersion"[^>]*>[^<]*</span>|<span id="appVersion" class="text-sm text-slate-400">'"${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-sm text-slate-400">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/" |