(prod) Release OpenAPI Spec 🚀. See https://github.com/mongodb/… #10
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
| name: Check & deploy API documentation | |
| on: | |
| # For deployments | |
| workflow_dispatch: # Allow manual trigger in case of quick fix | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'openapi/**.json' | |
| # For previews | |
| pull_request: | |
| branches: | |
| - main | |
| paths: | |
| - 'openapi/**.json' | |
| permissions: | |
| contents: read | |
| jobs: | |
| create-matrix: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| matrix: ${{ steps.set-matrix.outputs.matrix }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| - name: Generate matrix | |
| id: set-matrix | |
| env: | |
| ATLAS_ADMIN_V1_DOC_ID: ${{ vars.ATLAS_ADMIN_V1_DOC_ID }} | |
| ATLAS_ADMIN_V2_DOC_ID: ${{ vars.ATLAS_ADMIN_V2_DOC_ID }} | |
| run: | | |
| spec_mapping=$(node .github/scripts/generateSpecMapping.js) | |
| echo "matrix=$spec_mapping" >> "$GITHUB_OUTPUT" | |
| deploy-doc: | |
| needs: create-matrix | |
| if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }} | |
| name: Deploy API documentation on Bump.sh | |
| strategy: | |
| matrix: | |
| spec-mapping: ${{ fromJson(needs.create-matrix.outputs.matrix) }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Deploy API documentation | |
| uses: bump-sh/github-action@59eaae922e81ac8d127bd2b2ac6dc4804bda8a4c | |
| with: | |
| doc: ${{matrix.spec-mapping.doc}} | |
| token: ${{secrets.BUMP_TOKEN}} | |
| file: ${{matrix.spec-mapping.file}} | |
| branch: ${{matrix.spec-mapping.branch}} | |
| api-preview: | |
| needs: create-matrix | |
| if: ${{ github.event_name == 'pull_request' }} | |
| name: Create API preview on Bump.sh | |
| strategy: | |
| matrix: | |
| spec-mapping: ${{ fromJSON(needs.create-matrix.outputs.matrix) }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Create API preview | |
| uses: bump-sh/github-action@59eaae922e81ac8d127bd2b2ac6dc4804bda8a4c | |
| with: | |
| doc: ${{matrix.spec-mapping.doc}} | |
| token: ${{secrets.BUMP_TOKEN}} | |
| file: ${{matrix.spec-mapping.file}} | |
| branch: ${{matrix.spec-mapping.branch}} | |
| command: preview |