Skip to content

Commit fd870e4

Browse files
committed
ci(docs-bundle): publish the tarball from the docs publishing workflow
The tarball and the Meilisearch index are both copies of the same docs for AI Q&A, so they are now two jobs of one workflow (upload.yml, renamed "Publish docs for AI search") instead of two workflow files. It runs on the union of the paths either copy depends on; a Meilisearch sync with no doc changes re-embeds nothing. The bundle job runs the bundle tests, then builds and uploads the tarball to /docs (production) or /test/docs (development), with its own concurrency group so a newer run cancels an older one. A manual run of the workflow for an environment now refreshes both copies.
1 parent 0ec7fc8 commit fd870e4

2 files changed

Lines changed: 54 additions & 120 deletions

File tree

‎.github/workflows/docs-bundle-upload.yml‎

Lines changed: 0 additions & 115 deletions
This file was deleted.

‎.github/workflows/upload.yml‎

Lines changed: 54 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
# Upload documentation to Meilisearch for AI Q&A bot indexing.
1+
# Publish the docs for AI Q&A: sync them into Meilisearch, and publish
2+
# flashduty-docs.tar.gz (the same docs as Markdown files, plus the OpenAPI
3+
# specs and glossary) for tools that grep and read the docs directly.
24
#
3-
# Every run syncs the whole doc set: all docs are upserted and index documents
4-
# whose source file is gone are deleted.
5+
# The Meilisearch sync covers the whole doc set: all docs are upserted and
6+
# index documents whose source file is gone are deleted.
57
#
68
# Uses GitHub Environments for dev/prod separation. Create two environments in
79
# Settings > Environments: "development" and "production".
@@ -10,10 +12,13 @@
1012
# MEILI_ENDPOINT - Meilisearch instance URL
1113
# MEILI_API_KEY - API key with documents read/write permission
1214
# MEILI_INDEX - Target index name
15+
# Repository secrets for the tarball: CDN_ACCESS_KEY, CDN_SECRET_KEY,
16+
# CDN_BUCKET, CDN_REGION, CDN_ENDPOINT.
1317
#
14-
# Branch mapping: main -> production, test -> development
18+
# Branch mapping: main -> production (https://docs-cdn.flashcat.cloud/docs/),
19+
# test -> development (https://docs-cdn.flashcat.cloud/test/docs/)
1520

16-
name: Upload docs to Meilisearch
21+
name: Publish docs for AI search
1722

1823
on:
1924
push:
@@ -22,6 +27,13 @@ on:
2227
- 'zh/**'
2328
- 'en/**'
2429
- 'docs.json'
30+
- 'api-reference/**'
31+
- 'glossary.md'
32+
- 'integration-docs/scripts/*docs-bundle*'
33+
- 'integration-docs/scripts/oss-cdn.mjs'
34+
- 'integration-docs/scripts/cdn-url.mjs'
35+
- 'integration-docs/package.json'
36+
- '.github/workflows/upload.yml'
2537
workflow_dispatch:
2638
inputs:
2739
environment:
@@ -60,3 +72,40 @@ jobs:
6072
run: |
6173
chmod +x ./scripts/upload.sh
6274
bash ./scripts/upload.sh
75+
76+
bundle:
77+
runs-on: ubuntu-latest
78+
environment: ${{ github.event.inputs.environment || (github.ref == 'refs/heads/main' && 'production' || 'development') }}
79+
# Every run uploads the whole tarball, so a newer run supersedes an older
80+
# one; cancelling the older keeps it from finishing last with stale docs.
81+
concurrency:
82+
group: docs-bundle-${{ github.event.inputs.environment || (github.ref == 'refs/heads/main' && 'production' || 'development') }}
83+
cancel-in-progress: true
84+
steps:
85+
- name: Checkout
86+
uses: actions/checkout@v4
87+
88+
- name: Setup Node.js
89+
uses: actions/setup-node@v4
90+
with:
91+
node-version: 18
92+
93+
- name: Install dependencies
94+
working-directory: integration-docs
95+
run: npm install
96+
97+
- name: Test docs bundle scripts
98+
working-directory: integration-docs
99+
run: npm run test:docs-bundle
100+
101+
- name: Build and upload docs bundle
102+
working-directory: integration-docs
103+
env:
104+
CDN_ACCESS_KEY: ${{ secrets.CDN_ACCESS_KEY }}
105+
CDN_SECRET_KEY: ${{ secrets.CDN_SECRET_KEY }}
106+
CDN_BUCKET: ${{ secrets.CDN_BUCKET }}
107+
CDN_REGION: ${{ secrets.CDN_REGION }}
108+
CDN_ENDPOINT: ${{ secrets.CDN_ENDPOINT }}
109+
CDN_URL: 'https://docs-cdn.flashcat.cloud'
110+
CDN_DIR: ${{ (github.event.inputs.environment || (github.ref == 'refs/heads/main' && 'production' || 'development')) == 'production' && '/docs' || '/test/docs' }}
111+
run: npm run upload:docs-bundle

0 commit comments

Comments
 (0)