CI: better way of constructing version number
parent
45af7e4a7d
commit
5db2f17260
|
@ -2,6 +2,20 @@ variables:
|
|||
GIT_SUBMODULE_STRATEGY: normal
|
||||
TERM: linux
|
||||
|
||||
# The next stanza creates the version number used for the source tarball and the
|
||||
# binary packages. Here are the following possible cases:
|
||||
# - if VERSION was already set (when manually running a pipeline), use it
|
||||
# - if we are in the official Dynare repository:
|
||||
# + if on a tag: use the tag
|
||||
# + if on master: use 4.6-unstable-$TIMESTAMP-$COMMIT
|
||||
# + on another branch: use $BRANCH-$TIMESTAMP-$COMMIT
|
||||
# - if in a personal repository: use $USER-$TIMESTAMP-$COMMIT
|
||||
before_script:
|
||||
- '[ -z "$VERSION" ] && [ "$CI_PROJECT_NAMESPACE" = Dynare ] && [ -n "$CI_COMMIT_TAG" ] && export VERSION="$CI_COMMIT_TAG"'
|
||||
- '[ -z "$VERSION" ] && [ "$CI_PROJECT_NAMESPACE" = Dynare ] && [ "$CI_COMMIT_REF_NAME" = master ] && export VERSION="4.6-unstable-$(date +%F-%H%M)-$CI_COMMIT_SHORT_SHA"'
|
||||
- '[ -z "$VERSION" ] && [ "$CI_PROJECT_NAMESPACE" = Dynare ] && export VERSION="$CI_COMMIT_REF_NAME-$(date +%F-%H%M)-$CI_COMMIT_SHORT_SHA"'
|
||||
- '[ -z "$VERSION" ] && export VERSION="$CI_PROJECT_NAMESPACE-$(date +%F-%H%M)-$CI_COMMIT_SHORT_SHA"'
|
||||
|
||||
stages:
|
||||
- build
|
||||
- test_and_pkg
|
||||
|
|
|
@ -40,25 +40,15 @@ trap cleanup EXIT
|
|||
# Set the number of threads
|
||||
NTHREADS=$(nproc)
|
||||
|
||||
# Set Dynare version
|
||||
if [[ -n $CI_COMMIT_TAG ]]; then
|
||||
# Official release tagged through Gitlab
|
||||
VERSION=$CI_COMMIT_TAG
|
||||
VERSION_SHORT=$VERSION
|
||||
else
|
||||
# Set Dynare version, if not already set by Gitlab CI
|
||||
if [[ -z $VERSION ]]; then
|
||||
VERSION=$(grep '^AC_INIT(' ../configure.ac | sed 's/AC_INIT(\[dynare\], \[\(.*\)\])/\1/')
|
||||
if [[ -n $CI_COMMIT_SHA ]]; then
|
||||
VERSION_SHORT=$VERSION-$CI_COMMIT_SHORT_SHA
|
||||
VERSION=$VERSION-$CI_COMMIT_SHA
|
||||
elif [[ -d ../.git/ ]]; then
|
||||
VERSION_SHORT=$VERSION-$(git rev-parse --short HEAD)
|
||||
VERSION=$VERSION-$(git rev-parse HEAD)
|
||||
else
|
||||
VERSION_SHORT=$VERSION
|
||||
if [[ -d ../.git/ ]]; then
|
||||
VERSION=$VERSION-$(git rev-parse --short HEAD)
|
||||
fi
|
||||
fi
|
||||
|
||||
BASENAME=dynare-$VERSION_SHORT
|
||||
BASENAME=dynare-$VERSION
|
||||
|
||||
# Set directories for dependencies
|
||||
LIB32="$ROOT_DIRECTORY"/deps/lib32
|
||||
|
|
Loading…
Reference in New Issue