Skip to content

Commit

Permalink
Attempting to make full semver docker tags
Browse files Browse the repository at this point in the history
  • Loading branch information
sammyd committed Aug 9, 2020
1 parent 7db4504 commit 6710956
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,21 @@ jobs:
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Prefix tags with 'release'
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=release-$VERSION
if [[ "${{ github.ref }}" == "refs/tags/"* ]]; then
TAGS=$(echo "${VERSION}" | sed -E "s/v?([0-9]+)\.([0-9]+)\.([0-9]+)/release-\1.\2.\3 release-\1.\2 release-\1/g")
fi
# Use Docker `latest` tag convention
[ "$VERSION" == "master" ] && VERSION=latest
[ "$VERSION" == "development" ] && VERSION=staging
[ "$VERSION" == "master" ] && TAGS=latest
[ "$VERSION" == "development" ] && TAGS=staging
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
echo TAGS=$TAGS
docker tag image $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
for TAG in ${TAGS}; do
docker tag image "${IMAGE_ID}:${TAG}"
docker push "${IMAGE_ID}:${TAG}"
done
- name: Push image to GitHub
run: |
Expand All @@ -107,17 +111,21 @@ jobs:
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Prefix tags with 'release'
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=release-$VERSION
if [[ "${{ github.ref }}" == "refs/tags/"* ]]; then
TAGS=$(echo "${VERSION}" | sed -E "s/v?([0-9]+)\.([0-9]+)\.([0-9]+)/release-\1.\2.\3 release-\1.\2 release-\1/g")
fi
# Use Docker `latest` tag convention
[ "$VERSION" == "master" ] && VERSION=latest
[ "$VERSION" == "development" ] && VERSION=staging
[ "$VERSION" == "master" ] && TAGS=latest
[ "$VERSION" == "development" ] && TAGS=staging
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
echo TAGS=$TAGS
docker tag image $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
for TAG in ${TAGS}; do
docker tag image "${IMAGE_ID}:${TAG}"
docker push "${IMAGE_ID}:${TAG}"
done
- name: Logout of DockerHub Registry
if: ${{ always() }}
Expand Down

0 comments on commit 6710956

Please sign in to comment.