-
Notifications
You must be signed in to change notification settings - Fork 24
/
entrypoint.sh
executable file
·23 lines (19 loc) · 823 Bytes
/
entrypoint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env bash
set -e
export AWS_ACCESS_KEY_ID=$INPUT_ACCESS_KEY
export AWS_SECRET_ACCESS_KEY=$INPUT_SECRET_ACCESS_KEY
export AWS_DEFAULT_REGION=$INPUT_REGION
authTokenOutput=$(aws ecr get-authorization-token)
authString=$(echo "$authTokenOutput" | jq -r '.authorizationData[].authorizationToken' | base64 -d)
USERNAME=$(echo "$authString" | cut -d: -f1)
PASSWORD=$(echo "$authString" | cut -d: -f2)
REGISTRY=$(echo "$authTokenOutput" | jq -r '.authorizationData[].proxyEndpoint')
DOCKER_NAME=$(echo "$REGISTRY" | sed 's/https:\/\///g')
if [ -z "$USERNAME" ]; then
USERNAME="AWS"
fi
echo "username=${USERNAME}" >> "$GITHUB_OUTPUT"
echo "::add-mask::${PASSWORD}"
echo "password=${PASSWORD}" >> "$GITHUB_OUTPUT"
echo "registry=${REGISTRY}" >> "$GITHUB_OUTPUT"
echo "docker_name=${DOCKER_NAME}" >> "$GITHUB_OUTPUT"