Commit 2181cd4f authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

CI: Make it necessary to update the fslinstaller __version__ field, block

deployment if it doesn't match tag
parent 075ed952
......@@ -7,11 +7,16 @@
# First we copy the installer into the deployment directory, denoted by the
# $FSLINSTALLER_DEPLOY_DIRECTORY environment variable.
# copy the installer to the deploy directory,
# stamping it with the new version number.
PATTERN="s/^__version__ =.*/__version__ = '$CI_COMMIT_TAG'/g"
DEST=$FSLINSTALLER_DEPLOY_DIRECTORY/fslinstaller.py
cat fslinstaller.py | sed "$PATTERN" > $DEST
set -e
# Make sure that the installer version matches the tag
scriptver=$(cat fslinstaller.py | grep "__version__ = " | cut -d " " -f 3 | tr -d "'")
if [ "$scriptver" != "$CI_COMMIT_TAG" ]; then
echo "Version in fslinstaller.py does not match tag! $scriptver != $CI_COMMIT_TAG"
exit 1
fi
# Then we call the update_manifest.py script, which opens a merge request
# on the fsl/conda/manifest repository, to update the latest available
......
......@@ -11,6 +11,7 @@
# be copied.
stages:
- test
- check-version
- release
# Don't run pipeline on MRs
......@@ -79,6 +80,30 @@ test:py39:
extends: .test-template
image: python:3.9
check-version:
stage: check-version
image: python:3.9
tags:
- fsl-ci
- docker
rules:
- if: '$CI_COMMIT_BRANCH != "master"'
script:
- git fetch origin master
- thisver=$( cat fslinstaller.py | grep "__version__ = " | cut -d " " -f 3 | tr -d "'")
- masterver=$(git show origin/master:fslinstaller.py | grep "__version__ = " | cut -d " " -f 3 | tr -d "'")
- |
if [ "$thisver" = "$masterver" ]; then
echo "Version has not been updated!"
echo "Version on master branch: $masterver"
echo "Version in this MR: $thisver"
echo "The version number must be updated before this MR can be merged."
exit 1
else
echo "Version on master branch: $masterver"
echo "Version in this MR: $thisver"
fi
release:
image: python:3.9
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment