Skip to content

Commit daf6ba2

Browse files
committed
ci(docs) migrate to OIDC authentication
why: Replace legacy IAM credentials with short-lived OIDC tokens what: - Add id-token: write permission for OIDC - Add docs environment for scoped credentials - Use aws-actions/configure-aws-credentials with role assumption - Add targeted CloudFront invalidation
1 parent a5314e7 commit daf6ba2

File tree

1 file changed

+22
-9
lines changed

1 file changed

+22
-9
lines changed

.github/workflows/docs.yml

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,14 @@ on:
55
branches:
66
- master
77

8+
permissions:
9+
contents: read
10+
id-token: write
11+
812
jobs:
913
build:
1014
runs-on: ubuntu-latest
15+
environment: docs
1116
strategy:
1217
matrix:
1318
python-version: ['3.14']
@@ -60,17 +65,25 @@ jobs:
6065
run: |
6166
pushd docs; make SPHINXBUILD='uv run sphinx-build' html; popd
6267
63-
- name: Push documentation to S3
68+
- name: Configure AWS Credentials
6469
if: env.PUBLISH == 'true'
65-
uses: jakejarvis/s3-sync-action@v0.5.1
70+
uses: aws-actions/configure-aws-credentials@v4
6671
with:
67-
args: --follow-symlinks --delete
68-
env:
69-
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
70-
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
71-
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
72-
AWS_REGION: 'us-west-1' # optional: defaults to us-east-1
73-
SOURCE_DIR: 'docs/_build/html' # optional: defaults to entire repository
72+
role-to-assume: ${{ secrets.G_DOCS_ROLE_ARN }}
73+
aws-region: us-east-1
74+
75+
- name: Push documentation to S3
76+
if: env.PUBLISH == 'true'
77+
run: |
78+
aws s3 sync docs/_build/html "s3://${{ secrets.G_DOCS_BUCKET }}" \
79+
--delete --follow-symlinks
80+
81+
- name: Invalidate CloudFront
82+
if: env.PUBLISH == 'true'
83+
run: |
84+
aws cloudfront create-invalidation \
85+
--distribution-id "${{ secrets.G_DOCS_DISTRIBUTION }}" \
86+
--paths "/index.html" "/objects.inv" "/searchindex.js"
7487
7588
- name: Purge cache on Cloudflare
7689
if: env.PUBLISH == 'true'

0 commit comments

Comments
 (0)