Skip to content

Workflow file for this run

name: Build Docs
on:
push:
branches: [main]
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
jobs:
publish-docs:
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: current
- 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
run: npm run build
#-------------------------------#
# Push the website #
#-------------------------------#
# After running the build, copy the contents to the S3 bucket to be served, and invalidate the CloudFront cache so it starts serving the new content:
- name: Publish website
shell: bash
run: |
aws s3 sync ./build s3://www.fused.io/ --delete
- name: Invalidate CloudFront distribution
shell: bash
run: |
aws cloudfront create-invalidation --distribution-id E2ZP0BRHQ20MYJ --paths '/*'