Skip to content

Commit 4690640

Browse files
authored
chore(ci): update build pipeline to match concerto-docs (#532)
- Upgrade Node.js from 14.x to 20.x - Upgrade Docusaurus from 3.7.0 to 3.10.0 - Update GitHub Actions: checkout@v4, setup-node@v4 - Switch from AWS access keys to OIDC role assumption - Replace jakejarvis/s3-sync-action with native aws s3 sync - Add security linting: syncpack + lockfile-lint - Pin all dependencies to exact versions (no caret ranges) - Add .nvmrc for consistent local development - Add @docusaurus/faster for improved build performance - Add timeout-minutes and environment to workflow Signed-off-by: Matt Roberts <code@rbrts.uk>
1 parent 70ac9e8 commit 4690640

4 files changed

Lines changed: 2811 additions & 676 deletions

File tree

.github/workflows/build-and-publish.yml

Lines changed: 31 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,56 +5,64 @@ on:
55
branches:
66
- main
77

8+
permissions:
9+
id-token: write # This is required for requesting the JWT
10+
contents: read # This is required for actions/checkout
11+
812
jobs:
913

1014
build:
1115

1216
runs-on: ubuntu-latest
13-
env:
14-
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
15-
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
17+
environment: production
18+
timeout-minutes: 30
1619

1720
strategy:
1821
matrix:
19-
node-version: [14.x]
22+
node-version: [20.x]
2023

2124
steps:
2225
- name: Checkout code
23-
uses: actions/checkout@v2
26+
uses: actions/checkout@v4
2427

25-
- name: Use Node.js ${{ matrix.node-version }}
26-
uses: actions/setup-node@v1
28+
- name: Use Node.js 20.x
29+
uses: actions/setup-node@v4
2730
with:
28-
node-version: ${{ matrix.node-version }}
31+
node-version: '20'
32+
registry-url: 'https://registry.npmjs.org'
33+
34+
# Ensure npm 11.5.1 or later for trusted publishing
35+
- run: npm install -g npm@latest
2936

3037
- name: NPM Install
3138
if: github.ref == 'refs/heads/main'
32-
run: |
33-
cd ./website
34-
pwd
35-
npm install
39+
working-directory: ./website
40+
run: npm install
3641

3742
- name: NPM Build
3843
if: github.ref == 'refs/heads/main'
39-
run: |
40-
cd ./website
41-
pwd
42-
npm run build
44+
working-directory: ./website
45+
run: npm run build
4346

44-
- name: Set S3
47+
- name: configure aws credentials
4548
if: github.ref == 'refs/heads/main'
46-
run: |
47-
echo "AWS_S3_BUCKET=${{secrets.AWS_S3_BUCKET}}" >> $GITHUB_ENV
49+
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502
50+
with:
51+
role-to-assume: ${{ secrets.AWS_ROLE }}
52+
aws-region: ${{ secrets.AWS_REGION }}
4853

4954
- name: Deploy to S3
5055
if: github.ref == 'refs/heads/main'
51-
uses: jakejarvis/s3-sync-action@master
52-
with:
53-
args: --acl public-read --follow-symlinks --delete
56+
run: |
57+
aws s3 sync website/build s3://${{ secrets.AWS_S3_BUCKET }} \
58+
--acl public-read \
59+
--follow-symlinks \
60+
--delete
5461
env:
55-
SOURCE_DIR: 'website/build/techdocs'
62+
AWS_REGION: ${{ secrets.AWS_REGION }}
5663

5764
- name: Invalidate Cloudfront
65+
if: github.ref == 'refs/heads/main'
5866
uses: chetan/invalidate-cloudfront-action@master
5967
env:
6068
DISTRIBUTION: ${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION_ID }}

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
20.14.0

0 commit comments

Comments
 (0)