Skip to content

Add new file 7e3b9a1c5f8d42e6b0a7c4f9d2e18b63.txt (#3) #11

Add new file 7e3b9a1c5f8d42e6b0a7c4f9d2e18b63.txt (#3)

Add new file 7e3b9a1c5f8d42e6b0a7c4f9d2e18b63.txt (#3) #11

name: Build and deploy
# One workflow for both environments, selected by which repo it runs in:
# - QA fork -> CNAME qa.prodipdata.com
# - Production (ProdIPData/...) -> serves at the root domain, CNAME prodipdata.com
# It builds Astro, overlays any not-yet-migrated legacy files, writes the right
# CNAME, and deploys to that repo's GitHub Pages.
on:
push:
branches: [Redesign, main]
workflow_dispatch: {}
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
run: npm install
- name: Build Astro site
run: npm run build
env:
# Both QA (qa.prodipdata.com) and PROD (prodipdata.com) serve at the
# ROOT of their own custom domains, so the base path is '/' in both environments.
SITE_BASE: '/'
- name: Overlay legacy pages not yet migrated to Astro
# --ignore-existing means Astro-built pages are NEVER overwritten by legacy
# copies; legacy files only fill paths Astro hasn't produced yet.
run: |
rsync -a --ignore-existing \
--exclude '.git' \
--exclude '.github' \
--exclude 'node_modules' \
--exclude 'src' \
--exclude 'dist' \
--exclude 'public' \
--exclude 'package.json' \
--exclude 'package-lock.json' \
--exclude 'astro.config.mjs' \
--exclude '.gitignore' \
--exclude 'CNAME' \
--exclude '_seo_wave1_backup_20260416_135936' \
./ ./dist/
- name: Cosmetic fixes for legacy pages (header tagline, footer disclaimer, title case)
# Applied to built output only. Becomes a no-op as legacy pages migrate to Astro.
run: |
grep -rl 'Powered by ProdIPData' ./dist --include='*.html' | while read -r f; do
sed -i 's|<small>Powered by ProdIPData</small>|<small>Free monthly IP geolocation data</small>|g' "$f"
sed -i 's|<div>Engineered and published by the ProdIPData team.</div>|<div>Engineered and published by the ProdIPData team.</div><div class="muted">MaxMind and GeoIP are registered trademarks of MaxMind, Inc. ProdIPData is not affiliated with or endorsed by MaxMind.</div>|g' "$f"
done
grep -rl 'IP geolocation' ./dist --include='*.html' | while read -r f; do
sed -i 's|<title>IP geolocation |<title>IP Geolocation |g; s|content="IP geolocation |content="IP Geolocation |g' "$f"
done
- name: Set custom domain (per environment, never committed)
run: |
if [ "${{ github.repository }}" = "ProdIPData/prodipdata.github.io" ]; then
echo 'prodipdata.com' > ./dist/CNAME
else
echo 'qa.prodipdata.com' > ./dist/CNAME
fi
- name: Configure Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./dist
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4