Skip to content

Commit f9789e5

Browse files
authored
chore(ci): pull up update_layer_arn_docs and scope contents permissions (#2043)
* add contents read top level permission * remove double doc update, we will update doc after layer ARN PR merge * pull up layer ARN docs update * remove contents write for npm publish step * add pull-requests write permission from parnet call
1 parent 85817a8 commit f9789e5

5 files changed

+33
-81
lines changed

.github/workflows/make-release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ jobs:
3939
# Needed as recommended by npm docs on publishing with provenance https://docs.npmjs.com/generating-provenance-statements
4040
permissions:
4141
id-token: write
42-
contents: write
4342
environment: Release
4443
runs-on: ubuntu-latest
4544
outputs:
@@ -98,6 +97,7 @@ jobs:
9897
id-token: write
9998
contents: write
10099
pages: write
100+
pull-requests: write
101101
uses: ./.github/workflows/publish_layer.yml
102102
with:
103103
latest_published_version: ${{ needs.publish-npm.outputs.RELEASE_VERSION }}

.github/workflows/make-version.yml

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ name: Make Version
33
on:
44
workflow_dispatch: { }
55

6+
permissions:
7+
contents: read
8+
69

710
jobs:
811
bump-version:

.github/workflows/publish_layer.yml

+29-22
Original file line numberDiff line numberDiff line change
@@ -78,29 +78,36 @@ jobs:
7878
secrets:
7979
target-account-role: ${{ secrets.AWS_LAYERS_PROD_ROLE_ARN }}
8080

81-
prepare_docs_alias:
81+
update_layer_arn_docs:
82+
needs: [deploy-prod]
83+
# Force Github action to run only a single job at a time (based on the group name)
84+
# This is to prevent race-condition and inconsistencies with changelog push
85+
concurrency:
86+
group: changelog-build
8287
runs-on: ubuntu-latest
8388
permissions:
84-
contents: read
85-
outputs:
86-
DOCS_ALIAS: ${{ steps.set-alias.outputs.DOCS_ALIAS }}
89+
contents: write
90+
pull-requests: write
91+
id-token: none
8792
steps:
88-
- name: Set docs alias
89-
id: set-alias
93+
- name: Checkout repository # reusable workflows start clean, so we need to checkout again
94+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
95+
with:
96+
ref: ${{ github.sha }}
97+
- name: Download CDK layer artifact
98+
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
99+
with:
100+
name: cdk-layer-stack
101+
path: cdk-layer-stack/
102+
- name: Replace layer versions in documentation
90103
run: |
91-
DOCS_ALIAS=latest
92-
if [[ "${{ inputs.pre_release }}" == true ]] ; then
93-
DOCS_ALIAS=alpha
94-
fi
95-
echo DOCS_ALIAS="$DOCS_ALIAS" >> "$GITHUB_OUTPUT"
96-
97-
release-docs:
98-
needs: [ deploy-prod, prepare_docs_alias ]
99-
permissions:
100-
id-token: write
101-
secrets: inherit
102-
uses: ./.github/workflows/reusable_publish_docs.yml
103-
with:
104-
version: ${{ inputs.latest_published_version }}
105-
alias: ${{ needs.prepare_docs_alias.outputs.DOCS_ALIAS }}
106-
detached_mode: true
104+
ls -la cdk-layer-stack/
105+
./.github/scripts/update_layer_arn.sh cdk-layer-stack
106+
- name: Create PR
107+
id: create-pr
108+
uses: ./.github/actions/create-pr
109+
with:
110+
files: 'docs/index.md'
111+
temp_branch_prefix: 'ci-layer-docs'
112+
pull_request_title: 'chore(ci): update layer ARN on documentation'
113+
github_token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/reusable_deploy_layer_stack.yml

-8
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,3 @@ jobs:
100100
overwrite: true
101101
- name: CDK deploy canary
102102
run: npm run cdk -w layers -- deploy --app cdk.out --context region=${{ matrix.region }} 'CanaryStack' --require-approval never --verbose --outputs-file cdk-outputs.json
103-
update_layer_arn_docs:
104-
needs: deploy-cdk-stack
105-
permissions:
106-
contents: write
107-
if: ${{ inputs.stage == 'PROD' }}
108-
uses: ./.github/workflows/reusable_update_layer_arn_docs.yml
109-
with:
110-
latest_published_version: ${{ inputs.latest_published_version }}

.github/workflows/reusable_update_layer_arn_docs.yml

-50
This file was deleted.

0 commit comments

Comments
 (0)