-
Notifications
You must be signed in to change notification settings - Fork 1.1k
107 lines (91 loc) · 4 KB
/
docs.yml
File metadata and controls
107 lines (91 loc) · 4 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
98
99
100
101
102
103
104
105
106
107
name: Build and Deploy Docs
on:
# Deploy on push to main
push:
branches: [main]
# Deploy on workflow dispatch
workflow_dispatch: {}
concurrency:
group: ${{ github.workflow }}-${{ github.run_id }}
cancel-in-progress: false
permissions:
contents: read
id-token: write # required for Doppler OIDC
env:
UV_EXCLUDE_NEWER: "7 days"
jobs:
deploy:
runs-on: ubuntu-latest
timeout-minutes: 12
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: 🔐 Fetch Doppler secrets
uses: dopplerhq/secrets-fetch-action@cd2efbf9a404504316435873eff298b82f7e0562 # v1.3.0
id: secrets
with:
auth-method: oidc
doppler-identity-id: ${{ vars.DOPPLER_IDENTITY_ID }}
doppler-project: marimo-oss
doppler-config: ci_docs
- name: 🐍 Setup uv
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
with:
enable-cache: true
python-version: 3.12
- name: ⚡ Install Vercel CLI
run: npm install --ignore-scripts --global vercel@50.44.0
- name: ⬇️ Pull Vercel Environment Information
env:
VERCEL_ORG_ID: ${{ steps.secrets.outputs.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ steps.secrets.outputs.VERCEL_PROJECT_ID }}
VERCEL_TOKEN: ${{ steps.secrets.outputs.VERCEL_TOKEN }}
run: vercel pull --yes --environment=production
- name: 📚 Build docs
env:
VERCEL_ORG_ID: ${{ steps.secrets.outputs.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ steps.secrets.outputs.VERCEL_PROJECT_ID }}
VERCEL_TOKEN: ${{ steps.secrets.outputs.VERCEL_TOKEN }}
run: vercel build --prod
- name: 📝 Generate markdown versions of docs
run: |
uv run --group docs python docs/scripts/html_to_markdown.py \
--input-dir .vercel/output/static \
--base-url https://docs.marimo.io
- name: 🔀 Add edge middleware for markdown content negotiation
run: |
mkdir -p .vercel/output/functions/_middleware.func
cp docs/scripts/middleware.js .vercel/output/functions/_middleware.func/index.js
echo '{"runtime":"edge","entrypoint":"index.js"}' > .vercel/output/functions/_middleware.func/.vc-config.json
uv run --group docs python docs/scripts/patch_vercel_config.py .vercel/output/config.json
- name: 📚 llms.txt
# This is technically off by 1 commit, but generating the llms.txt file is easiest from a
# deployed site.
# We also ignore txt and xml files
run: npx sitefetch https://docs.marimo.io -o ${{ env.OUTPUT_FILE }} --match '!**/*.{txt,xml}'
env:
OUTPUT_FILE: .vercel/output/static/llms.txt
- name: 📚 CLAUDE.md
run: cp docs/_static/CLAUDE.md .vercel/output/static/CLAUDE.md
# Skip deploy if a newer commit has landed on main while this run was building,
# so an older run can't overwrite a newer deploy. The run still completes green.
- name: 🔍 Check if still tip of main
id: latest
if: github.ref == 'refs/heads/main'
env:
GH_SHA: ${{ github.sha }}
GH_REPO: ${{ github.repository }}
run: |
LATEST_SHA=$(git ls-remote "https://github.com/${GH_REPO}.git" refs/heads/main | awk '{print $1}')
if [ "$LATEST_SHA" = "$GH_SHA" ]; then
echo "is_latest=true" >> "$GITHUB_OUTPUT"
else
echo "is_latest=false" >> "$GITHUB_OUTPUT"
echo "::notice::Skipping deploy — superseded by a newer commit on main ($LATEST_SHA)."
fi
- name: 🚀 Deploy to Vercel
if: github.ref == 'refs/heads/main' && steps.latest.outputs.is_latest == 'true'
env:
VERCEL_ORG_ID: ${{ steps.secrets.outputs.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ steps.secrets.outputs.VERCEL_PROJECT_ID }}
VERCEL_TOKEN: ${{ steps.secrets.outputs.VERCEL_TOKEN }}
run: vercel deploy --prebuilt --prod