-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (64 loc) · 2.83 KB
/
Copy pathdeploy-website.yml
File metadata and controls
74 lines (64 loc) · 2.83 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
# NOTE: automatic triggering is disabled — see DEPLOYMENT.md "Marketing site".
# The ghost-app Vercel project (VERCEL_PROJECT_ID below) currently has its Root
# Directory overridden to cloud/apps/web, which now serves the live cloud SaaS
# app at ghost.muharafiq.com. Because that override applies regardless of what
# changed in the push, running this workflow as-is would redeploy cloud/apps/web
# again, not public/, no matter what the steps below claim. Do not re-enable the
# push trigger or run this via workflow_dispatch until public/ has its own
# Vercel project (or domain) pointed at this directory, or is retired.
name: Deploy Website
on:
workflow_dispatch:
permissions:
contents: read
jobs:
deploy:
name: Deploy to Vercel (public/ — target currently misconfigured, see note above)
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v7
- name: Setup Node.js
uses: actions/setup-node@v7
with:
node-version: "20"
- name: Verify public directory
run: |
test -d public || { echo "public/ directory not found" >&2; exit 1; }
echo "Files to deploy:"
find public -type f | sort
echo "Total files: $(find public -type f | wc -l)"
- name: Validate SoftwareApplication JSON-LD
run: |
grep -q '"@type": "SoftwareApplication"' public/index.html \
|| { echo "Missing SoftwareApplication schema" >&2; exit 1; }
# Extract JSON-LD blocks and parse them as JSON.
python3 - <<'PY'
import json, pathlib, re, sys
html = pathlib.Path("public/index.html").read_text()
blocks = re.findall(
r'<script type="application/ld\+json">\s*(.*?)\s*</script>',
html,
flags=re.S,
)
if not blocks:
print("No JSON-LD blocks found", file=sys.stderr)
sys.exit(1)
for i, block in enumerate(blocks, 1):
json.loads(block)
print(f"JSON-LD block {i}: OK")
PY
- name: Install Vercel CLI
run: npm install -g vercel@latest
- name: Deploy to Vercel
env:
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
run: |
echo "::warning::VERCEL_PROJECT_ID's Root Directory is overridden to cloud/apps/web, so this will deploy the cloud app, not public/. See the note at the top of this workflow file."
echo "Deploying public/ to Vercel…"
vercel deploy --prod --token="${VERCEL_TOKEN}" --yes
- name: Deployment summary
run: |
echo "Deployed $(find public -type f | wc -l) files from public/ (see the warning above about where this actually landed)"