Skip to content

Commit 12660f7

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 452ebc9 commit 12660f7

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']
@@ -52,17 +57,25 @@ jobs:
5257
run: |
5358
pushd docs; make SPHINXBUILD='uv run sphinx-build' html; popd
5459
55-
- name: Push documentation to S3
60+
- name: Configure AWS Credentials
5661
if: env.PUBLISH == 'true'
57-
uses: jakejarvis/s3-sync-action@v0.5.1
62+
uses: aws-actions/configure-aws-credentials@v4
5863
with:
59-
args: --follow-symlinks --delete
60-
env:
61-
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
62-
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
63-
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
64-
AWS_REGION: 'us-west-1' # optional: defaults to us-east-1
65-
SOURCE_DIR: 'docs/_build/html' # optional: defaults to entire repository
64+
role-to-assume: ${{ secrets.LIBVCS_DOCS_ROLE_ARN }}
65+
aws-region: us-east-1
66+
67+
- name: Push documentation to S3
68+
if: env.PUBLISH == 'true'
69+
run: |
70+
aws s3 sync docs/_build/html "s3://${{ secrets.LIBVCS_DOCS_BUCKET }}" \
71+
--delete --follow-symlinks
72+
73+
- name: Invalidate CloudFront
74+
if: env.PUBLISH == 'true'
75+
run: |
76+
aws cloudfront create-invalidation \
77+
--distribution-id "${{ secrets.LIBVCS_DOCS_DISTRIBUTION }}" \
78+
--paths "/index.html" "/objects.inv" "/searchindex.js"
6679
6780
- name: Purge cache on Cloudflare
6881
if: env.PUBLISH == 'true'

0 commit comments

Comments
 (0)