Skip to content

chore(ci): pull up update_layer_arn_docs and scope contents permissions #2043

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

Merged
merged 5 commits into from
Feb 9, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/make-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ jobs:
# Needed as recommended by npm docs on publishing with provenance https://docs.npmjs.com/generating-provenance-statements
permissions:
id-token: write
contents: write
environment: Release
runs-on: ubuntu-latest
outputs:
Expand Down Expand Up @@ -98,6 +97,7 @@ jobs:
id-token: write
contents: write
pages: write
pull-requests: write
uses: ./.github/workflows/publish_layer.yml
with:
latest_published_version: ${{ needs.publish-npm.outputs.RELEASE_VERSION }}
3 changes: 3 additions & 0 deletions .github/workflows/make-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name: Make Version
on:
workflow_dispatch: { }

permissions:
contents: read


jobs:
bump-version:
Expand Down
51 changes: 29 additions & 22 deletions .github/workflows/publish_layer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,29 +78,36 @@ jobs:
secrets:
target-account-role: ${{ secrets.AWS_LAYERS_PROD_ROLE_ARN }}

prepare_docs_alias:
update_layer_arn_docs:
needs: [deploy-prod]
# Force Github action to run only a single job at a time (based on the group name)
# This is to prevent race-condition and inconsistencies with changelog push
concurrency:
group: changelog-build
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
DOCS_ALIAS: ${{ steps.set-alias.outputs.DOCS_ALIAS }}
contents: write
pull-requests: write
id-token: none
steps:
- name: Set docs alias
id: set-alias
- name: Checkout repository # reusable workflows start clean, so we need to checkout again
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
ref: ${{ github.sha }}
- name: Download CDK layer artifact
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
with:
name: cdk-layer-stack
path: cdk-layer-stack/
- name: Replace layer versions in documentation
run: |
DOCS_ALIAS=latest
if [[ "${{ inputs.pre_release }}" == true ]] ; then
DOCS_ALIAS=alpha
fi
echo DOCS_ALIAS="$DOCS_ALIAS" >> "$GITHUB_OUTPUT"

release-docs:
needs: [ deploy-prod, prepare_docs_alias ]
permissions:
id-token: write
secrets: inherit
uses: ./.github/workflows/reusable_publish_docs.yml
with:
version: ${{ inputs.latest_published_version }}
alias: ${{ needs.prepare_docs_alias.outputs.DOCS_ALIAS }}
detached_mode: true
ls -la cdk-layer-stack/
./.github/scripts/update_layer_arn.sh cdk-layer-stack
- name: Create PR
id: create-pr
uses: ./.github/actions/create-pr
with:
files: 'docs/index.md'
temp_branch_prefix: 'ci-layer-docs'
pull_request_title: 'chore(ci): update layer ARN on documentation'
github_token: ${{ secrets.GITHUB_TOKEN }}
8 changes: 0 additions & 8 deletions .github/workflows/reusable_deploy_layer_stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,3 @@ jobs:
overwrite: true
- name: CDK deploy canary
run: npm run cdk -w layers -- deploy --app cdk.out --context region=${{ matrix.region }} 'CanaryStack' --require-approval never --verbose --outputs-file cdk-outputs.json
update_layer_arn_docs:
needs: deploy-cdk-stack
permissions:
contents: write
if: ${{ inputs.stage == 'PROD' }}
uses: ./.github/workflows/reusable_update_layer_arn_docs.yml
with:
latest_published_version: ${{ inputs.latest_published_version }}
50 changes: 0 additions & 50 deletions .github/workflows/reusable_update_layer_arn_docs.yml

This file was deleted.