Publish docs to staging website (for PR) #425
Workflow file for this run
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: Staging Deploy | |
| run-name: Publish docs to staging website (for PR) | |
| on: | |
| pull_request: | |
| # Allow running from the actions tab | |
| workflow_dispatch: | |
| inputs: | |
| schema_branch: | |
| description: 'Schema branch to pull from for /reference' | |
| required: true | |
| default: 'main' | |
| permissions: | |
| id-token: write | |
| contents: read | |
| jobs: | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out the main docs repo repository and build. | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| - name: Install NPM dependencies | |
| run: npm install --prefer-dedupe | |
| - name: Build Docusaurus website | |
| env: | |
| DOCUSAURUS_URL: https://dfhx9f55j8eg5.cloudfront.net/ | |
| DOCUSAURUS_BASE_URL: /how-to/pr/${{github.event.number}}/ | |
| SCHEMA_BRANCH: ${{ inputs.schema_branch }} | |
| run: npm run build | |
| - name: Upload docs build as GH-Pages artifact 📦 | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| path: build | |
| name: build | |
| publish_staging: | |
| name: Publish to Staging Bucket | |
| environment: | |
| name: staging | |
| url: https://dfhx9f55j8eg5.cloudfront.net/how-to/pr/${{github.event.number}}/ | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Fetch AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| role-to-assume: arn:aws:iam::207370808101:role/Overture_GitHub_schema_Publish_Docs_Staging | |
| aws-region: us-west-2 | |
| - name: Download GH-Pages artifact 📦 | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: build | |
| path: build | |
| - name: Copy to staging bucket how-to/pr/${{github.event.number}}/ | |
| run: | | |
| aws --region us-east-2 s3 sync --delete --storage-class INTELLIGENT_TIERING build s3://overture-schema-docs-static-staging-us-east-2/how-to/pr/${{github.event.number}} | |
| - name: Purge CDN cache | |
| run: | | |
| aws cloudfront create-invalidation --distribution-id E3L106P8HVBE9L --paths "/how-to/pr/${{github.event.number}}/*" |