Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

Commit

Permalink
Merge pull request #7 from kayac/feature/for-org-internal-release
Browse files Browse the repository at this point in the history
 Release for our organization
  • Loading branch information
mashiike committed Jul 7, 2020
2 parents f783614 + 5159742 commit 305a00f
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 8 deletions.
17 changes: 16 additions & 1 deletion publish-only.sh
@@ -1,12 +1,27 @@
#!/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
region=${AWS_REGION:?no-region}
LAYER_NAME="bash"

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 ""
Expand Down
23 changes: 19 additions & 4 deletions publish-staging.sh
@@ -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"
11 changes: 8 additions & 3 deletions publish.sh
@@ -1,4 +1,9 @@
#!/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=(
Expand All @@ -24,12 +29,12 @@ LAYER_NAME="bash"
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)
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 --principal \*)

echo $LAYER_ARN
echo "$region complete"
echo ""
done

echo "Successfully published to all regions"
echo "Successfully published to all regions"

0 comments on commit 305a00f

Please sign in to comment.