Fix Docker build versioning (#20077)
* Centralise version scripts and fix Docker version * Refactor generation of a git-hash-based version into get-version-from-git * Refactor normalization of versions (stripping leading v) into normalize-version.sh * Call get-version-from-git from ci_package.sh, call normalize-version from package.sh * Refactor docker-write-version.sh into docker-package.sh, which both writes the version file and invokes yarn build passing VERSION * Normalize the version received from the server
This commit is contained in:
parent
b3c5bb899b
commit
b0abbfacd4
7 changed files with 36 additions and 36 deletions
21
scripts/docker-package.sh
Executable file
21
scripts/docker-package.sh
Executable file
|
@ -0,0 +1,21 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -ex
|
||||
|
||||
TAG=$(git describe --tags)
|
||||
BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
||||
DIST_VERSION=$TAG
|
||||
|
||||
# If the branch comes out as HEAD then we're probably checked out to a tag, so if the thing is *not*
|
||||
# coming out as HEAD then we're on a branch. When we're on a branch, we want to resolve ourselves to
|
||||
# a few SHAs rather than a version.
|
||||
# Docker Hub doesn't always check out the tag and sometimes checks out the branch, so we should look
|
||||
# for an appropriately tagged branch as well (heads/v1.2.3).
|
||||
if [[ $BRANCH != HEAD && ! $BRANCH =~ heads/v.+ ]]
|
||||
then
|
||||
DIST_VERSION=`$(dirname $0)/get-version-from-git.sh`
|
||||
fi
|
||||
|
||||
DIST_VERSION=`$(dirname $0)/normalize-version.sh ${DIST_VERSION}`
|
||||
VERSION=$DIST_VERSION yarn build
|
||||
echo $DIST_VERSION > /src/webapp/version
|
Loading…
Add table
Add a link
Reference in a new issue