Repository navigation
48 lines (41 loc) · 1.62 KB
/
Copy pathdeploy-api-docs.yml
File metadata and controls
48 lines (41 loc) · 1.62 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
name: Deploy API docs to Cloudflare Pages
on:
push:
branches: [main]
paths:
- 'proto/gen/grpc-doc/openapi.yaml'
- 'docs/api/**'
- '.github/workflows/deploy-api-docs.yml'
workflow_dispatch:
permissions:
contents: read
deployments: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: 26
# The buf plugin emits a placeholder info block; give the published spec a real title.
- name: Assemble site
run: |
mkdir -p out
cp docs/api/index.html docs/api/favicon.png out/
sed -e '1,5s/^ title: API$/ title: Bytebase API Reference/' \
-e '1,5s/^ description: API documentation for API$/ description: API reference for Bytebase. Every endpoint is served by your own Bytebase instance./' \
proto/gen/grpc-doc/openapi.yaml > out/openapi.yaml
head -5 out/openapi.yaml
# Create the Pages project on first run; a no-op once it exists.
- name: Ensure Cloudflare Pages project exists
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
run: npx --yes wrangler@3 pages project create bytebase-api --production-branch=main || true
- name: Deploy to Cloudflare Pages
uses: cloudflare/wrangler-action@v4
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy ./out --project-name=bytebase-api