forked from stefda/action-cloud-run
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentrypoint.sh
More file actions
40 lines (30 loc) · 839 Bytes
/
entrypoint.sh
File metadata and controls
40 lines (30 loc) · 839 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/sh
set -e
echo "$INPUT_SERVICE_KEY" | base64 --decode > "$HOME"/gcloud.json
if [ "$INPUT_ENV" ]
then
ENVS=$(cat "$INPUT_ENV" | xargs | sed 's/ /,/g')
fi
if [ "$ENVS" ]
then
ENV_FLAG="--set-env-vars $ENVS"
else
ENV_FLAG="--clear-env-vars"
fi
if ["$INPUT_MIN_INSTANCES"]
then
ENG_FLAG="--min-instances=$INPUT_MIN_INSTANCES $ENV_FLAG"
fi
if ["$INPUT_CLOUD_SQL"]
then
ENV_FLAG="--add-cloudsql-instances $INPUT_CLOUD_SQL --update-env-vars INSTANCE_CONNECTION_NAME=$INPUT_CLOUD_SQL $ENV_FLAG"
fi
gcloud auth activate-service-account --key-file="$HOME"/gcloud.json --project "$INPUT_PROJECT"
gcloud auth configure-docker
docker push "$INPUT_IMAGE"
gcloud beta run deploy "$INPUT_SERVICE" \
--image "$INPUT_IMAGE" \
--region "$INPUT_REGION" \
--platform managed \
--allow-unauthenticated \
${ENV_FLAG}