-
Notifications
You must be signed in to change notification settings - Fork 12
83 lines (71 loc) · 2.56 KB
/
deploy.yml
File metadata and controls
83 lines (71 loc) · 2.56 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
name: Deploy to Cloudflare Pages
on:
push:
branches:
- master
workflow_dispatch:
inputs:
bactopia_ref:
description: 'bactopia/bactopia ref to checkout (branch, tag, or SHA)'
required: false
default: 'main'
jobs:
build-and-deploy:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout docs repo
uses: actions/checkout@v4
- name: Checkout bactopia source repo
uses: actions/checkout@v4
with:
repository: bactopia/bactopia
path: bactopia-source
ref: ${{ github.event.inputs.bactopia_ref || 'master' }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install Python dependencies
run: pip install -r requirements.txt
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
- name: Install Node dependencies
run: npm ci
- name: Generate docs from bactopia source
run: make generate BACTOPIA_REPO=bactopia-source
env:
BACTOPIA_DEV_PYTHON: python
- name: Build Docusaurus site
run: npm run build
env:
ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }}
ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }}
ALGOLIA_ASK_AI_ID: ${{ secrets.ALGOLIA_ASK_AI_ID }}
- name: Assemble version snapshots from branches
run: |
for snap in $(python3 -c "import json; [print(s['version']) for s in json.load(open('snapshots.json'))['snapshots'] if s['active']]"); do
branch="snapshot/$snap"
target="build/$snap"
echo "Fetching $branch -> $target"
git fetch origin "$branch" --depth=1 || { echo "WARNING: branch $branch not found, skipping"; continue; }
mkdir -p "$target"
git archive "origin/$branch" | tar -x -C "$target"
done
- name: Report deployment file count
run: |
count=$(find build -type f | wc -l)
echo "Total deployment files: $count / 20000"
if [ "$count" -gt 19000 ]; then
echo "::warning::Approaching Cloudflare Pages 20k file limit: $count files"
fi
- name: Deploy to Cloudflare Pages
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy build/ --project-name=bactopia-docs --branch=main