2323 build-layer :
2424 runs-on : ubuntu-latest
2525 if : ${{ (github.event.workflow_run.conclusion == 'success') || (github.event_name == 'workflow_dispatch') }}
26- defaults :
27- run :
28- working-directory : ./layer-publisher
2926 steps :
3027 - name : checkout
3128 uses : actions/checkout@v3
@@ -41,22 +38,32 @@ jobs:
4138 LATEST_TAG=$(git describe --tag --abbrev=0)
4239 RELEASE_TAG_VERSION=${RELEASE_INPUT:-$LATEST_TAG}
4340 echo "RELEASE_TAG_VERSION=${RELEASE_TAG_VERSION:1}" >> $GITHUB_ENV
44- - name : install cdk and deps
45- run : |
46- npm install -g aws-cdk@2.55.0
47- cdk --version
48- - name : install deps
41+ - name : Cache node modules
42+ id : cache-node-modules
43+ uses : actions/cache@v3
44+ with :
45+ path : " ./node_modules"
46+ # Use the combo between node version, name, and SHA-256 hash of the lock file as cache key so that
47+ # if one of them changes the cache is invalidated/discarded
48+ key : 18-cache-utilities-node-modules-${{ hashFiles('./package-lock.json') }}
49+ - name : Install dependencies
50+ # We can skip the installation if there was a cache hit
51+ if : steps.cache-node-modules.outputs.cache-hit != 'true'
52+ # See https://github.com/npm/cli/issues/4475 to see why --foreground-scripts
53+ run : npm ci --foreground-scripts
54+ - name : Create layer files
4955 run : |
50- npm ci
56+ export VERSION=$RELEASE_TAG_VERSION
57+ bash .github/scripts/setup_tmp_layer_files.sh
5158 - name : CDK build
52- run : cdk synth --context PowerToolsPackageVersion =$RELEASE_TAG_VERSION -o cdk.out
59+ run : npm run cdk -w layers -- synth --context PowertoolsPackageVersion =$RELEASE_TAG_VERSION -o cdk.out
5360 - name : zip output
5461 run : zip -r cdk.out.zip cdk.out
5562 - name : Archive CDK artifacts
5663 uses : actions/upload-artifact@v3
5764 with :
58- name : cdk-layer-artefact
59- path : layer-publisher /cdk.out.zip
65+ name : cdk-layer-artifact
66+ path : layers /cdk.out.zip
6067
6168 # Deploy layer to all regions in beta account
6269 deploy-beta :
6572 uses : ./.github/workflows/reusable_deploy_layer_stack.yml
6673 with :
6774 stage : " BETA"
68- artefact -name : " cdk-layer-artefact "
75+ artifact -name : " cdk-layer-artifact "
6976 secrets :
7077 target-account-role : ${{ secrets.AWS_LAYERS_BETA_ROLE_ARN }}
7178
7683 uses : ./.github/workflows/reusable_deploy_layer_stack.yml
7784 with :
7885 stage : " PROD"
79- artefact -name : " cdk-layer-artefact "
86+ artifact -name : " cdk-layer-artifact "
8087 secrets :
8188 target-account-role : ${{ secrets.AWS_LAYERS_PROD_ROLE_ARN }}
0 commit comments