Skip to content

Commit b4a5321

Browse files
Making SAR version works as expected
1 parent b655b13 commit b4a5321

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

.github/workflows/reusable_deploy_v3_sar.yml

+9-11
Original file line numberDiff line numberDiff line change
@@ -130,25 +130,23 @@ jobs:
130130
ARCH_NAME=$(echo ${{ matrix.architecture }} | tr -d '_')
131131
SAR_NAME="${SAR_NAME}-python${{env.PYTHON_VERSION}}-${ARCH_NAME}"
132132
echo SAR_NAME="${SAR_NAME}" >> "$GITHUB_ENV"
133-
- name: Normalize semantic version
134-
id: semantic-version # v2.0.0a0 -> v2.0.0-a0
135-
env:
136-
VERSION: ${{ inputs.package-version }}
137-
run: |
138-
VERSION="${VERSION/a/-a}"
139-
echo "VERSION=${VERSION}" >> "$GITHUB_OUTPUT"
140133
- name: Prepare SAR App
141-
env:
142-
VERSION: ${{ steps.semantic-version.outputs.VERSION }}
143134
run: |
144135
# From the generated LayerStack cdk.out artifact, find the layer asset path for the correct architecture.
145136
# We'll use this as the source directory of our SAR. This way we are re-using the same layer asset for our SAR.
146137
PYTHON_VERSION=$(echo ${{ matrix.python-version }} | tr -d '.')
147-
asset=$(jq -jc '.Resources[] | select(.Properties.CompatibleArchitectures == ["${{ matrix.architecture }}"]) | .Metadata."aws:asset:path"' "cdk.out/LayerV3Stack-python${PYTHON_VERSION}.template.json")
138+
asset_cdk=$(jq -jc '.Resources[] | select(.Properties.CompatibleArchitectures == ["${{ matrix.architecture }}"]) | .Metadata."aws:asset:path"' "cdk.out/LayerV3Stack-python${PYTHON_VERSION}.template.json")
139+
140+
echo "Normalizing the asset variable"
141+
asset=$(echo $asset_cdk | sed -E 's/^(asset\.[^.]+).*\1/\1/')
142+
143+
VERSION=$(echo ${{ inputs.package-version }} | sed 's/^v//')
144+
echo $asset
145+
echo $VERSION
148146
149147
# fill in the SAR SAM template
150148
sed \
151-
-e "s|<VERSION>|${{ env.VERSION }}|g" \
149+
-e "s|<VERSION>|${VERSION}|g" \
152150
-e "s/<SAR_APP_NAME>/${{ env.SAR_NAME }}/g" \
153151
-e "s|<LAYER_CONTENT_PATH>|./cdk.out/$asset|g" \
154152
-e "s|<PYTHON_RUNTIME>|${{ matrix.python-version }}|g" \

0 commit comments

Comments
 (0)