Skip to content

Commit

Permalink
Fix build major and minor tag versions as well
Browse files Browse the repository at this point in the history
  • Loading branch information
lgrahl committed Apr 4, 2019
1 parent da37638 commit b9731a1
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,23 +131,30 @@ jobs:
- run:
name: Determine tag name
command: |
tag=$([ -n "${CIRCLE_TAG}" ] && echo "${CIRCLE_TAG:1}" || echo "${CIRCLE_BRANCH}")
echo "Mapping branch ${CIRCLE_BRANCH} to ${tag}"
echo "export TAG=${tag}" >> ${BASH_ENV}
tags="${CIRCLE_BRANCH}"
if [ -n "${CIRCLE_TAG}" ]; then
minortag=$(echo ${CIRCLE_TAG} | sed 's/^\(v[0-9]*\.[0-9]*\)\..*$/\1/')
majortag=$(echo ${CIRCLE_TAG} | sed 's/^\(v[0-9]*\)\..*$/\1/')
tags="${CIRCLE_TAG:1} ${minortag:1} ${majortag:1}"
fi
echo "Mapping to tags: ${tags}"
echo "export TAGS=\"${tags}\"" >> ${BASH_ENV}
- run:
name: Build Docker image
command: |
source ${BASH_ENV}
docker build \
--no-cache \
-t saltyrtc/saltyrtc-server-python:${TAG} \
.
docker build --no-cache -t saltyrtc-server-python .
for tag in ${TAGS}; do
docker tag saltyrtc-server-python saltyrtc/saltyrtc-server-python:${tag}
done
- run:
name: Push Docker image
command: |
source ${BASH_ENV}
docker login -u ${DOCKER_USER} -p ${DOCKER_API_KEY}
docker push saltyrtc/saltyrtc-server-python:${TAG}
for tag in ${TAGS}; do
docker push saltyrtc/saltyrtc-server-python:${tag}
done
- when:
condition: << parameters.rebuild >>
steps:
Expand Down

0 comments on commit b9731a1

Please sign in to comment.