This repository has been archived by the owner on Oct 8, 2021. It is now read-only.
forked from gkrizek/bash-lambda-layer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from kayac/feature/for-org-internal-release
Release for our organization
- Loading branch information
Showing
3 changed files
with
43 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,34 @@ | ||
#!/bin/bash -e | ||
GIT_VER=$(git describe --tags) | ||
DATE=$(date +%Y-%m-%dT%H:%M:%S%z) | ||
DESCRIPTION="Bash in AWS Lambda version $GIT_VER [https://github.com/kayac/bash-lambda-layer] | ||
published at $DATE | ||
" | ||
|
||
# AWS Regions | ||
REGIONS=( | ||
"us-west-2" | ||
"${AWS_REGION:?no-region}" | ||
) | ||
LAYER_NAME="bash-testing" | ||
|
||
for region in ${REGIONS[@]}; do | ||
echo "Publishing layer to $region..." | ||
|
||
LAYER_ARN=$(aws lambda publish-layer-version --region $region --layer-name $LAYER_NAME --description "Bash in AWS Lambda [https://github.com/gkrizek/bash-lambda-layer]" --compatible-runtimes provided --license MIT --zip-file fileb://export/layer.zip | jq -r .LayerVersionArn) | ||
|
||
LAYER_ARN=$(aws lambda publish-layer-version --region $region --layer-name $LAYER_NAME --description "$DESCRIPTION" --compatible-runtimes provided --license MIT --zip-file fileb://export/layer.zip | jq -r .LayerVersionArn) | ||
if [ -n "$PERMISSION" ]; then | ||
POLICY=$(aws lambda add-layer-version-permission \ | ||
--region $region \ | ||
--layer-name $LAYER_NAME \ | ||
--version-number $(echo -n $LAYER_ARN | tail -c 1) \ | ||
--statement-id $LAYER_NAME-public \ | ||
--action lambda:GetLayerVersion \ | ||
$PERMISSION) | ||
echo $POLICY | ||
fi | ||
|
||
echo $LAYER_ARN | ||
echo "$region complete for Staging" | ||
echo "" | ||
done | ||
|
||
echo "Successfully published to all regions" | ||
echo "Successfully published to all regions" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters