Skip to content

Commit f262d4d

Browse files
author
Alexander Wang
committed
Deploy docs through AWS OIDC
1 parent a565b42 commit f262d4d

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

.github/workflows/ci.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ jobs:
6363
needs: [ci, nofixups, spell-check, alt-tags-check, webp-versions-check]
6464
runs-on: ubuntu-latest
6565
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
66+
permissions:
67+
contents: read
68+
id-token: write
69+
env:
70+
D2_DOCS_S3_BUCKET: s3://d2lang-docs-278852893615
71+
D2_DOCS_CLOUDFRONT_ID: E2NLB7I775SAF
6672
steps:
6773
- uses: actions/checkout@v3
6874
with:
@@ -76,14 +82,11 @@ jobs:
7682
- name: Configure AWS credentials
7783
uses: aws-actions/configure-aws-credentials@v2
7884
with:
79-
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
80-
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
85+
role-to-assume: arn:aws:iam::278852893615:role/d2lang-docs-deploy
8186
aws-region: us-west-1
8287
- name: Install dependencies
8388
run: yarn install --frozen-lockfile
8489
- name: Deploy to production
8590
run: ./ci/deploy.sh
8691
env:
87-
D2_DOCS_S3_BUCKET: ${{ secrets.D2_DOCS_S3_BUCKET }}
88-
D2_DOCS_CLOUDFRONT_ID: ${{ secrets.D2_DOCS_CLOUDFRONT_ID }}
8992
D2_DOCS_ALGOLIA_CRAWLER_API_KEY: ${{ secrets.D2_DOCS_ALGOLIA_CRAWLER_API_KEY }}

ci/deploy.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,10 @@ fi
2121

2222
DOCUSAURUS_IGNORE_SSG_WARNINGS=true npm run prod
2323
aws sts get-caller-identity --no-cli-pager > /dev/null
24-
aws s3 sync ./build ${D2_DOCS_S3_BUCKET} --delete --acl public-read --no-cli-pager
24+
aws s3 sync ./build ${D2_DOCS_S3_BUCKET} --delete --no-cli-pager
2525
aws cloudfront create-invalidation --distribution-id ${D2_DOCS_CLOUDFRONT_ID} --paths "/*" --no-cli-pager
2626

2727
curl -H "Content-Type: application/json" \
2828
-X POST \
2929
--user dd0bd3fe-db42-4673-89ae-e7e70dfae16b:${D2_DOCS_ALGOLIA_CRAWLER_API_KEY} \
3030
"https://crawler.algolia.com/api/1/crawlers/2d841c67-ab75-4fb1-9114-f8844363d74c/reindex"
31-

0 commit comments

Comments
 (0)