bw-export/ci/docker-publish.sh

19 lines
537 B
Bash
Raw Normal View History

2023-03-19 21:07:09 +01:00
#!/bin/bash
DOCKER_SCOPE=${DOCKER_USERNAME:-"mastermindzh"}
TAGS=(
"latest"
"$(cat package.json | grep version | head -1 | awk -F: '{ print $2}' | sed 's/[\",]//g' | tr -d '[[:space:]]')"
"$(git rev-parse HEAD)"
)
NAME=$(cat package.json | grep name | head -1 | awk -F: '{ print $2}' | sed 's/[\",]//g' | tr -d '[[:space:]]')
docker build -t "$DOCKER_SCOPE/$NAME:latest" .
for tag in "${TAGS[@]}"; do
docker tag "$DOCKER_SCOPE/$NAME:latest" "$DOCKER_SCOPE/$NAME:$tag"
docker push "$DOCKER_SCOPE/$NAME:$tag"
done