Skip to content

Commit 29f654b

Browse files
author
Alexander Melnyk
committed
fix(ci): lambda layer workflow release version and conditionals (#1316)
1 parent d440e99 commit 29f654b

File tree

3 files changed

+32
-27
lines changed

3 files changed

+32
-27
lines changed

.github/workflows/publish_layer.yml

+6-4
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,23 @@ on:
1616
types:
1717
- completed
1818

19+
1920
jobs:
2021
build-layer:
2122
runs-on: ubuntu-latest
23+
if: ${{ (github.event.workflow_run.conclusion == 'success') || (github.event_name == 'workflow_dispatch') }}
2224
defaults:
2325
run:
2426
working-directory: ./layer
2527
steps:
2628
- name: checkout
2729
uses: actions/checkout@v3
30+
with:
31+
fetch-depth: 0
2832
- name: Setup Node.js
2933
uses: actions/setup-node@v3
3034
with:
3135
node-version: "16.12"
32-
- name: Install poetry
33-
run: pipx install poetry
3436
- name: Setup python
3537
uses: actions/setup-python@v4
3638
with:
@@ -39,8 +41,8 @@ jobs:
3941
- name: Set release notes tag
4042
run: |
4143
RELEASE_INPUT=${{ inputs.latest_published_version }}
42-
GITHUB_EVENT_RELEASE_TAG=${{ github.event.release.tag_name }}
43-
RELEASE_TAG_VERSION=${GITHUB_EVENT_RELEASE_TAG:-$RELEASE_INPUT}
44+
LATEST_TAG=$(git describe --tag --abbrev=0)
45+
RELEASE_TAG_VERSION=${RELEASE_INPUT:-$LATEST_TAG}
4446
echo "RELEASE_TAG_VERSION=${RELEASE_TAG_VERSION:1}" >> $GITHUB_ENV
4547
- name: install cdk and deps
4648
run: |

.github/workflows/reusable_deploy_layer_stack.yml

+24-22
Original file line numberDiff line numberDiff line change
@@ -26,28 +26,30 @@ jobs:
2626
strategy:
2727
fail-fast: false
2828
matrix:
29-
region: ["af-south-1"]
30-
# "eu-central-1",
31-
# "us-east-1",
32-
# "us-east-2",
33-
# "us-west-1",
34-
# "us-west-2",
35-
# "ap-east-1",
36-
# "ap-south-1",
37-
# "ap-northeast-1",
38-
# "ap-northeast-2",
39-
# "ap-southeast-1",
40-
# "ap-southeast-2",
41-
# "ca-central-1",
42-
# "eu-west-1",
43-
# "eu-west-2",
44-
# "eu-west-3",
45-
# "eu-south-1",
46-
# "eu-north-1",
47-
# "sa-east-1",
48-
# "ap-southeast-3",
49-
# "ap-northeast-3",
50-
# "me-south-1"
29+
region: [
30+
"af-south-1",
31+
# "eu-central-1",
32+
# "us-east-1",
33+
# "us-east-2",
34+
# "us-west-1",
35+
# "us-west-2",
36+
# "ap-east-1",
37+
# "ap-south-1",
38+
# "ap-northeast-1",
39+
# "ap-northeast-2",
40+
# "ap-southeast-1",
41+
# "ap-southeast-2",
42+
# "ca-central-1",
43+
# "eu-west-1",
44+
# "eu-west-2",
45+
# "eu-west-3",
46+
# "eu-south-1",
47+
# "eu-north-1",
48+
# "sa-east-1",
49+
# "ap-southeast-3",
50+
# "ap-northeast-3",
51+
# "me-south-1"
52+
]
5153
steps:
5254
- name: checkout
5355
uses: actions/checkout@v3

layer/layer/layer_stack.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from aws_cdk import Stack
1+
from aws_cdk import RemovalPolicy, Stack
22
from aws_cdk.aws_ssm import StringParameter
33
from cdk_lambda_powertools_python_layer import LambdaPowertoolsLayer
44
from constructs import Construct
@@ -15,5 +15,6 @@ def __init__(
1515
)
1616

1717
layer.add_permission("PublicLayerAccess", account_id="*")
18+
layer.apply_removal_policy(RemovalPolicy.RETAIN)
1819

1920
StringParameter(self, "VersionArn", parameter_name=ssm_paramter_layer_arn, string_value=layer.layer_version_arn)

0 commit comments

Comments
 (0)