Repository navigation
97 lines (85 loc) · 2.93 KB
/
Copy pathdeploy.yml
File metadata and controls
97 lines (85 loc) · 2.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# Deploy — builds the static export and publishes it to GitHub Pages.
# One-time setup: repo Settings → Pages → Source: GitHub Actions.
# Vercel remains the recommended deployment target (zero config, see README);
# this workflow keeps a fully static, server-free Pages mirror available.
name: Deploy to GitHub Pages
on:
push:
branches: [main]
workflow_dispatch:
inputs:
site_url:
description: "Public site URL (custom domain). Empty = github.io default"
required: false
default: ""
concurrency:
group: pages
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Compute base path and site URL
id: paths
env:
MANUAL_SITE_URL: ${{ github.event.inputs.site_url }}
run: |
# Canonical lowercase host (github.io serves as pushyanth02.github.io)
OWNER_LC="${{ github.repository_owner }}"
ORIGIN="https://${OWNER_LC,,}.github.io"
# SITE_URL is the ORIGIN ONLY (no base path) — site-config.ts
# concatenates SITE_URL + SITE_BASE_PATH, so baking the base path
# into SITE_URL would double it in every canonical URL.
# Custom domains (workflow_dispatch) serve at the domain root.
if [[ -n "$MANUAL_SITE_URL" ]]; then
BASE=""
SITE_URL="${MANUAL_SITE_URL%/}"
elif [[ "${{ github.repository }}" == *.github.io ]]; then
# Root repo (owner.github.io): serves at /
BASE=""
SITE_URL="$ORIGIN"
else
# Project page: serves at /<repo-name>
BASE="/${{ github.event.repository.name }}"
SITE_URL="$ORIGIN"
fi
echo "base=$BASE" >> "$GITHUB_OUTPUT"
echo "site_url=$SITE_URL" >> "$GITHUB_OUTPUT"
echo "Building with BASE='$BASE' SITE_URL='$SITE_URL'"
- name: Static export
run: bun run build:pages
env:
NEXT_PUBLIC_BASE_PATH: ${{ steps.paths.outputs.base }}
NEXT_PUBLIC_SITE_URL: ${{ steps.paths.outputs.site_url }}
- name: Verify export artifacts
run: |
test -f out/index.html
test -f out/llms.txt
echo "Export verified"
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: out
deploy:
needs: build
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Configure Pages
uses: actions/configure-pages@v5
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4