Files
loto/.github/workflows/deploy-github-pages.yml
T
tiennm99 10c0bf85f3 ci: GitHub Pages now serves a redirect to loto.miti99.com
Replace the full build+publish flow with a tiny inline shell step that
emits two static HTML pages (out/index.html and out/master/index.html).
Each one carries:

  <meta http-equiv="refresh" content="0; url=https://loto.miti99.com/">
  <script>location.replace("https://loto.miti99.com" + ...)</script>

The script preserves path / query / hash, so
  /loto/                  → loto.miti99.com/
  /loto/master            → loto.miti99.com/master
  /loto/?x=1              → loto.miti99.com/?x=1

Cloudflare Pages stays canonical; this change just stops GH Pages from
serving a stale duplicate of the app and points old links at the live
domain instead.

The build:gh npm script is kept as a manual escape hatch for the rare
case where someone wants to deploy a real GH Pages copy by hand.
2026-04-26 21:19:40 +07:00

69 lines
2.0 KiB
YAML

name: Deploy redirect to GitHub Pages
on:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: github-pages
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Generate redirect pages
run: |
set -euo pipefail
DEST="https://loto.miti99.com"
mkdir -p out/master
cat > out/index.html <<HTML
<!doctype html>
<html lang="vi">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Lô tô — đã chuyển sang ${DEST}</title>
<link rel="canonical" href="${DEST}/">
<meta http-equiv="refresh" content="0; url=${DEST}/">
<meta name="robots" content="noindex">
<script>
(function () {
var path = location.pathname.replace(/^\/loto/, "");
location.replace("${DEST}" + path + location.search + location.hash);
})();
</script>
<style>
body { font-family: system-ui, sans-serif; padding: 3rem 1.5rem; text-align: center; color: #475569; }
a { color: #6366f1; }
</style>
</head>
<body>
<p>Trang đã chuyển sang <a href="${DEST}/">${DEST}</a></p>
</body>
</html>
HTML
# Mirror to /master so deep links also redirect cleanly
cp out/index.html out/master/index.html
- uses: actions/configure-pages@v5
- uses: actions/upload-pages-artifact@v3
with:
path: out
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@v4