|
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. |
2 | 4 | # |
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. |
5 | 7 | # |
6 | 8 | # Uses GitHub Environments for dev/prod separation. Create two environments in |
7 | 9 | # Settings > Environments: "development" and "production". |
|
10 | 12 | # MEILI_ENDPOINT - Meilisearch instance URL |
11 | 13 | # MEILI_API_KEY - API key with documents read/write permission |
12 | 14 | # MEILI_INDEX - Target index name |
| 15 | +# Repository secrets for the tarball: CDN_ACCESS_KEY, CDN_SECRET_KEY, |
| 16 | +# CDN_BUCKET, CDN_REGION, CDN_ENDPOINT. |
13 | 17 | # |
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/) |
15 | 20 |
|
16 | | -name: Upload docs to Meilisearch |
| 21 | +name: Publish docs for AI search |
17 | 22 |
|
18 | 23 | on: |
19 | 24 | push: |
|
22 | 27 | - 'zh/**' |
23 | 28 | - 'en/**' |
24 | 29 | - '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' |
25 | 37 | workflow_dispatch: |
26 | 38 | inputs: |
27 | 39 | environment: |
|
60 | 72 | run: | |
61 | 73 | chmod +x ./scripts/upload.sh |
62 | 74 | 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