Commit 8c5e5ac7 authored by Ruben ten Hove's avatar Ruben ten Hove
Browse files

feat: repo version check

parent b4e86341
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
---
variables:
  CURRENT_CI_TEMPLATES_VERSION: 6.27.3
  UPDATE_CHECK_REPOSITORY: https://gitlab.com/just-ci/templates.git

include:
  - local: project-automation/workflow.yml
  - local: project-automation/find-next-release.yml
@@ -6,6 +10,7 @@ include:
  - local: project-automation/semantic-release.yml
  - local: project-automation/generic.yaml
  - local: project-automation/tbump.yml
  - local: project-automation/update-check.yml

tbump:
  extends:
+22 −0
Original line number Diff line number Diff line
---
update-check:
  stage: .pre
  image: docker:git
  variables:
    GIT_STRATEGY: none
  script:
    - LATEST_VERSION=$(git ls-remote --tags ${UPDATE_CHECK_REPOSITORY} | cut -d/
      -f3 | grep -E 'v[0-9]+\.[0-9]+\.[0-9]+' | sort -V | tail -n1)\
    - |
      if [ $(echo -e "${CURRENT_REPOSITORY_VERSION}\n${LATEST_VERSION}" | sort -V | head -n1) == "${CURRENT_REPOSITORY_VERSION}" ]; then
        echo "Your current CI templates version ${CURRENT_REPOSITORY_VERSION} is older than the latest ${LATEST_VERSION}"
        exit 1
      else
        echo "Your current CI templates version ${CURRENT_REPOSITORY_VERSION} is up to date"
      fi
  rules:
    - if: $DISABLE_UPDATE_CHECK
      when: never
    - if: $UPDATE_CHECK_REPOSITORY && $CURRENT_REPOSITORY_VERSION
  allow_failure: true
  needs: []