Merge pull request #467 from flashcatcloud/feat/alert-integrations #340
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Publish the docs for AI Q&A: sync them into Meilisearch, and publish | |
| # flashduty-docs.tar.gz (the same docs as Markdown files, plus the OpenAPI | |
| # specs and glossary) for tools that grep and read the docs directly. | |
| # | |
| # The Meilisearch sync covers the whole doc set: all docs are upserted and | |
| # index documents whose source file is gone are deleted. | |
| # | |
| # Uses GitHub Environments for dev/prod separation. Create two environments in | |
| # Settings > Environments: "development" and "production". | |
| # | |
| # Per-environment secrets (all required, keep as secrets to hide Meilisearch endpoint): | |
| # MEILI_ENDPOINT - Meilisearch instance URL | |
| # MEILI_API_KEY - API key with documents read/write permission | |
| # MEILI_INDEX - Target index name | |
| # Branch mapping for the Meilisearch sync: main -> production, | |
| # test -> development. | |
| # | |
| # The tarball is published from main only, to the Flashduty static | |
| # distribution: https://static.flashcat.cloud/flashduty-docs/flashduty-docs.tar.gz | |
| # (OSS bucket flashduty-public). Every deployment reads that one copy. | |
| # Repository secrets for it: STATIC_ACCESS_KEY, STATIC_SECRET_KEY (an AK allowed | |
| # to put objects under flashduty-public/flashduty-docs/). | |
| name: Publish docs for AI search | |
| on: | |
| push: | |
| branches: [main, test] | |
| paths: | |
| - 'zh/**' | |
| - 'en/**' | |
| - 'docs.json' | |
| - 'api-reference/**' | |
| - 'glossary.md' | |
| - 'integration-docs/scripts/*docs-bundle*' | |
| - 'integration-docs/scripts/oss-cdn.mjs' | |
| - 'integration-docs/scripts/cdn-url.mjs' | |
| - 'integration-docs/package.json' | |
| - '.github/workflows/upload.yml' | |
| workflow_dispatch: | |
| inputs: | |
| environment: | |
| description: 'Target environment' | |
| required: true | |
| default: 'production' | |
| type: choice | |
| options: | |
| - production | |
| - development | |
| jobs: | |
| upload: | |
| runs-on: ubuntu-latest | |
| environment: ${{ github.event.inputs.environment || (github.ref == 'refs/heads/main' && 'production' || 'development') }} | |
| # One sync per index at a time: an older run listing the index while a | |
| # newer one uploads would delete the newer run's added docs. | |
| concurrency: | |
| group: meilisearch-upload-${{ github.event.inputs.environment || (github.ref == 'refs/heads/main' && 'production' || 'development') }} | |
| cancel-in-progress: false | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y jq | |
| jq --version | |
| - name: Upload to Meilisearch | |
| env: | |
| MEILI_ENDPOINT: ${{ secrets.MEILI_ENDPOINT }} | |
| MEILI_API_KEY: ${{ secrets.MEILI_API_KEY }} | |
| MEILI_INDEX: ${{ secrets.MEILI_INDEX }} | |
| run: | | |
| chmod +x ./scripts/upload.sh | |
| bash ./scripts/upload.sh | |
| bundle: | |
| if: github.ref == 'refs/heads/main' | |
| runs-on: ubuntu-latest | |
| # Every run uploads the whole tarball, so a newer run supersedes an older | |
| # one; cancelling the older keeps it from finishing last with stale docs. | |
| concurrency: | |
| group: docs-bundle | |
| cancel-in-progress: true | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 18 | |
| - name: Install dependencies | |
| working-directory: integration-docs | |
| run: npm install | |
| - name: Test docs bundle scripts | |
| working-directory: integration-docs | |
| run: npm run test:docs-bundle | |
| - name: Build and upload docs bundle | |
| working-directory: integration-docs | |
| env: | |
| CDN_ACCESS_KEY: ${{ secrets.STATIC_ACCESS_KEY }} | |
| CDN_SECRET_KEY: ${{ secrets.STATIC_SECRET_KEY }} | |
| CDN_BUCKET: 'flashduty-public' | |
| CDN_REGION: 'oss-cn-beijing' | |
| CDN_ENDPOINT: 'oss-cn-beijing.aliyuncs.com' | |
| CDN_URL: 'https://static.flashcat.cloud' | |
| CDN_DIR: '/flashduty-docs' | |
| run: npm run upload:docs-bundle |