mirror of
https://github.com/tiennm99/loto.git
synced 2026-10-14 12:17:00 +00:00
ci: bring back GitHub Pages auto-deploy
.github/workflows/deploy-github-pages.yml runs `npm run build:gh` on push to main and uploads build/ via actions/upload-pages-artifact@v3 + actions/deploy-pages@v4. The build:gh script sets BUILD_PROFILE=gh, which switches svelte.config.js basePath to /loto so assets resolve under tiennm99.github.io/loto. Cloudflare Pages keeps deploying in parallel via the CF dashboard (npm run build, root basePath, loto.miti99.com). Two URLs, no conflict.
This commit is contained in:
1 parent
a70a05d23c
commit
6dd7ce86f6
3 files changed
+60
-10
No files matched your search
+41
@@ -0,0 +1,41 @@
|
||||
name: Deploy 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
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
cache: npm
|
||||
- run: npm ci
|
||||
- run: npm run build:gh
|
||||
- uses: actions/configure-pages@v5
|
||||
- uses: actions/upload-pages-artifact@v3
|
||||
with:
|
||||
path: build
|
||||
|
||||
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
|
||||
@@ -32,18 +32,26 @@ pushes to `main` trigger automatic builds + deploys.
|
||||
|
||||
No GitHub Actions involved; no repo secrets needed.
|
||||
|
||||
## Manual GH Pages Deploy (optional)
|
||||
## GitHub Pages (parallel auto-deploy)
|
||||
|
||||
If you ever want to push a build to GitHub Pages by hand:
|
||||
`.github/workflows/deploy-github-pages.yml` runs on every push to `main`,
|
||||
builds with `npm run build:gh` (basePath `/loto`), and publishes `build/`
|
||||
as a Pages artifact.
|
||||
|
||||
URL: `https://tiennm99.github.io/loto`.
|
||||
|
||||
CF Pages and GH Pages run in parallel — different URLs, different
|
||||
artifacts, no conflict. Drop GH Pages by deleting the workflow file.
|
||||
|
||||
### Manual GH Pages Deploy
|
||||
|
||||
If you'd rather export by hand:
|
||||
|
||||
```bash
|
||||
npm run build:gh
|
||||
# upload build/ to the GH Pages target
|
||||
```
|
||||
|
||||
The repo no longer auto-deploys to GH Pages — there's no GitHub Actions
|
||||
workflow. CF Pages is the only auto-deploy target.
|
||||
|
||||
## Development Environment
|
||||
|
||||
### Local Dev
|
||||
@@ -147,10 +155,11 @@ Generates:
|
||||
|
||||
## CI/CD Pipeline
|
||||
|
||||
Cloudflare Pages handles CI/CD automatically:
|
||||
- GitHub Pages deployment removed (Cloudflare is primary).
|
||||
- Manual fallback: `npm run build:gh && git push` (if needed).
|
||||
- No GitHub Actions workflow for automatic GH Pages deploy.
|
||||
Both providers auto-deploy on push to `main`:
|
||||
- **Cloudflare Pages** — wired via the CF dashboard, builds with `npm run build`,
|
||||
publishes to `loto.miti99.com`.
|
||||
- **GitHub Pages** — wired via `.github/workflows/deploy-github-pages.yml`,
|
||||
builds with `npm run build:gh`, publishes to `tiennm99.github.io/loto`.
|
||||
|
||||
## Performance Checklist
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ State is entirely client-side. Each page/card instance uses a unique localStorag
|
||||
|
||||
## Deployment
|
||||
|
||||
- **Production**: Cloudflare Pages auto-deploys from `main` branch (configured via the CF dashboard, no GitHub Actions). Custom domain `loto.miti99.com`. `npm run build:gh` is a manual fallback for GitHub Pages at the `/loto` basePath.
|
||||
- **Production**: dual auto-deploy on push to `main` — Cloudflare Pages at `loto.miti99.com` (CF dashboard, root basePath) and GitHub Pages at `tiennm99.github.io/loto` (`.github/workflows/deploy-github-pages.yml`, `/loto` basePath via `npm run build:gh`).
|
||||
- **Development**: `npm run dev` (local), `npm run dev:codeserver` (code-server via proxy).
|
||||
- **Build**: `npm run build` generates static export to `build/` directory.
|
||||
|
||||
|
||||
Reference in new issue
Block a user