diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 09daf3d91614e6240231073fb7affbbc7d1981ea..818ebf5cdf2ba269f4e4b53f342491608c4384e1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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 diff --git a/windows/build.sh b/windows/build.sh index 4de3a7f446a07cec8caf04c198b5ecbcd2a180e0..768abb58d572649a6b46497ba093d71b6c10c2fa 100755 --- a/windows/build.sh +++ b/windows/build.sh @@ -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