diff --git a/.github/workflows/on_push_docs.yml b/.github/workflows/on_push_docs.yml index 340f669b0f7..e257f49e808 100644 --- a/.github/workflows/on_push_docs.yml +++ b/.github/workflows/on_push_docs.yml @@ -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 diff --git a/.github/workflows/publish_v2_layer.yml b/.github/workflows/publish_v2_layer.yml index dcdc43a6e2c..5447d0a51e5 100644 --- a/.github/workflows/publish_v2_layer.yml +++ b/.github/workflows/publish_v2_layer.yml @@ -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 @@ -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 }} diff --git a/.github/workflows/rebuild_latest_docs.yml b/.github/workflows/rebuild_latest_docs.yml index 3e481860992..deac728ac25 100644 --- a/.github/workflows/rebuild_latest_docs.yml +++ b/.github/workflows/rebuild_latest_docs.yml @@ -14,11 +14,15 @@ on: default: "2.0.0" required: true +permissions: + id-token: write + jobs: release-docs: permissions: contents: write pages: write + id-token: write uses: ./.github/workflows/reusable_publish_docs.yml with: version: ${{ inputs.latest_published_version }} diff --git a/.github/workflows/reusable_publish_docs.yml b/.github/workflows/reusable_publish_docs.yml index eb0d8f8598a..f624d327ee5 100644 --- a/.github/workflows/reusable_publish_docs.yml +++ b/.github/workflows/reusable_publish_docs.yml @@ -26,6 +26,7 @@ on: default: develop permissions: + id-token: write contents: write pages: write @@ -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: @@ -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 }}/