Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(docs): Move docs to S3 #2277

Merged
merged 5 commits into from
May 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/on_push_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,15 @@ on:
- "examples/**"
- "CHANGELOG.md"

permissions:
id-token: write

jobs:
release-docs:
permissions:
contents: write
pages: write
id-token: write
uses: ./.github/workflows/reusable_publish_docs.yml
with:
version: develop
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish_v2_layer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
permissions:
# lower privilege propagated from parent workflow (release.yml)
contents: read
id-token: none
id-token: write
pages: none
pull-requests: none
runs-on: aws-lambda-powertools_ubuntu-latest_8-core
Expand Down Expand Up @@ -223,7 +223,7 @@ jobs:
contents: write
pages: write
pull-requests: none
id-token: none
id-token: write
uses: ./.github/workflows/reusable_publish_docs.yml
with:
version: ${{ inputs.latest_published_version }}
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/rebuild_latest_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,15 @@ on:
default: "2.0.0"
required: true

permissions:
id-token: write

Comment on lines +17 to +19
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simon, we are trying to keep the permissions very granular in our worflows and I don't think this is necessary as you are adding this permission on the release-docs job. Have you tried without it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that if you don't have id-token: write on the caller, it won't pass it down – I kept getting a id-token should be none error

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the explanation, Simon! In the future we'll refactor this workflows and we can review this.

jobs:
release-docs:
permissions:
contents: write
pages: write
id-token: write
uses: ./.github/workflows/reusable_publish_docs.yml
with:
version: ${{ inputs.latest_published_version }}
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/reusable_publish_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ on:
default: develop

permissions:
id-token: write
contents: write
pages: write

Expand All @@ -36,6 +37,7 @@ jobs:
concurrency:
group: on-docs-rebuild
runs-on: ubuntu-latest
environment: Docs
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
with:
Expand Down Expand Up @@ -88,3 +90,27 @@ jobs:
publish_dir: ./api
keep_files: true
destination_dir: latest/api
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@e1e17a757e536f70e52b5a12b2e8d1d1c60e04ef
with:
aws-region: us-east-1
role-to-assume: ${{ secrets.AWS_DOCS_ROLE_ARN }}
- name: Copy API Docs
run: |
cp -r api site/
- name: Deploy Docs (Version)
env:
VERSION: ${{ inputs.version }}
ALIAS: ${{ inputs.alias }}
run: |
aws s3 sync \
site/ \
s3://${{ secrets.AWS_DOCS_BUCKET }}/lambda-python/${{ env.VERSION }}/
- name: Deploy Docs (Alias)
env:
VERSION: ${{ inputs.version }}
ALIAS: ${{ inputs.alias }}
run: |
aws s3 sync \
site/ \
s3://${{ secrets.AWS_DOCS_BUCKET }}/lambda-python/${{ env.ALIAS }}/