to get the proper version from GitHub releases. Only use git describe when docker builds master use the tag name which is stored in the environment variable SOURCE_BRANCH. See: https://docs.docker.com/docker-cloud/builds/advanced/#override-build-test-or-push-commands
22 lines
295 B
Bash
Executable File
22 lines
295 B
Bash
Executable File
#!/bin/bash
|
|
|
|
|
|
|
|
git_version=$(git describe HEAD --tags --abbrev=4)
|
|
|
|
|
|
if [ ${SOURCE_BRANCH} == "master" ]
|
|
then
|
|
version=$git_version
|
|
else
|
|
version=$(echo ${SOURCE_BRANCH} | sed 's/v//')
|
|
fi
|
|
|
|
cat << EOF > puppetboard/version.py
|
|
#
|
|
# Puppetboard version module
|
|
#
|
|
__version__ = '${version}'
|
|
EOF
|
|
|