Skip to content

Commit 958f3e8

Browse files
author
James Chien
committed
fix(scripts/deploy-release.sh): avoid bumping version in deploy script
and reuse keys Signed-off-by: James Chien <james@numbersprotocol.io>
1 parent 9d61bcc commit 958f3e8

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

scripts/deploy-release.sh

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@ S3_BUCKET="numbers-static"
77

88
# Define S3 keys for paths
99
LATEST_KEY="capture-eye/release/latest/capture-eye.bundled.js"
10-
VERSION_KEY="capture-eye/release/$(npm version --no-git-tag-version patch)/capture-eye.bundled.js"
10+
VERSION_KEY="capture-eye/release/$(npm pkg get version | tr -d \")/capture-eye.bundled.js"
1111

1212
# CloudFront invalidation paths
13-
INVALIDATION_PATHS=(
14-
"/capture-eye/release/latest/capture-eye.bundled.js"
15-
"/capture-eye/release/$(npm version --no-git-tag-version patch)/capture-eye.bundled.js"
16-
)
13+
INVALIDATION_PATHS="/$LATEST_KEY /$VERSION_KEY"
14+
15+
echo "Invalidation paths: $INVALIDATION_PATHS"
1716

1817
# Upload to S3 (latest version)
1918
aws s3 cp $FILE_PATH s3://$S3_BUCKET/$LATEST_KEY
@@ -31,11 +30,8 @@ if [ $? -ne 0 ]; then
3130
fi
3231
echo "File uploaded to s3://$S3_BUCKET/$VERSION_KEY"
3332

34-
# Create invalidation paths string
35-
INVALIDATION_PATHS_STRING=$(printf ' "%s"' "${INVALIDATION_PATHS[@]}")
36-
3733
# Create the invalidation
38-
INVALIDATION_ID=$(aws cloudfront create-invalidation --distribution-id $DISTRIBUTION_ID --paths $INVALIDATION_PATHS_STRING --query 'Invalidation.Id' --output text)
34+
INVALIDATION_ID=$(aws cloudfront create-invalidation --distribution-id $DISTRIBUTION_ID --paths $INVALIDATION_PATHS --query 'Invalidation.Id' --output text)
3935
if [ $? -ne 0 ]; then
4036
echo "Failed to create invalidation"
4137
exit 1

0 commit comments

Comments
 (0)