Publish docs to staging website (for PR) #35
Workflow file for this run
This file contains 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: Docs staging deploy for PRs | |
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 | |
env: | |
# Using same bucket name as for staging deployment | |
BUCKET_NAME: 's3://docs-staging.fused.io' | |
CLOUDFRONT_ID: 'E33Z2H4C1WZOKH' | |
jobs: | |
build_and_publish: | |
environment: | |
name: staging | |
url: https://docs-staging.fused.io/pr/${{github.event.number}} | |
name: Build documentation and publish to staging | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
# Auth with OIDC: | |
# https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-amazon-web-services | |
- name: configure aws credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: arn:aws:iam::926411091187:role/github_website_role | |
role-session-name: GithubFusedLabsFusedPyReleaseDocs | |
aws-region: us-west-2 | |
- name: Use Node.js | |
id: setup-node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 23.1.0 | |
- name: Cache node modules | |
id: cache-npm | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-node-modules | |
with: | |
# npm cache files are stored in `~/.npm` on Linux/macOS | |
path: ~/.npm | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }} | |
name: List the state of node modules | |
continue-on-error: true | |
run: npm list | |
- name: Install dependencies | |
run: npm install | |
- name: Build docs | |
env: | |
DEPLOYMENT_URL: 'https://docs-staging.fused.io' | |
BASE_URL: '/pr/${{github.event.number}}' | |
IS_STAGING: 'true' | |
run: npm run build | |
# Is this correct? | |
- name: Copy Docusaurus website to staging bucket to new PR prefix ${{env.BUCKET_NAME}}/pr/${{github.event.number}}/ | |
run: | | |
aws --region us-east-2 s3 sync --delete --storage-class INTELLIGENT_TIERING build ${{env.BUCKET_NAME}}/pr/${{github.event.number}} |