-
Notifications
You must be signed in to change notification settings - Fork 9
72 lines (58 loc) · 2.17 KB
/
docs.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
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 '/*'