Commit 0510d314 authored by Federico Falconieri's avatar Federico Falconieri
Browse files

Merge branch 'hoverht-master-patch-21280' into 'master'

refactor: use simple versioning

See merge request ci/templates!110
parents a94108ab 82daf9dd
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
[tool.poetry]
name = "ci-templates"
version = "3.9.0"
version = "3.19.0"
description = ""
authors = ["Federico Falconieri <federico.falconieri@tno.nl>, Ruben ten Hove <ruben.tenhove@tno.nl>"]
license = "LGPLv3"
@@ -18,6 +18,4 @@ requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

[tool.semantic_release]
version_pattern = [
    'pyproject.toml:version = "(\d+\.\d+\.\d+)"'
]
version_toml = "pyproject.toml:tool.poetry.version"
+3 −19
Original line number Diff line number Diff line
@@ -2,27 +2,11 @@
python:semantic-release:version:
  image: registry.gitlab.com/notno/python-tests:latest
  stage: build
  variables:
    EXTRA_ARGS: ""
  script:
    - pip install python-semantic-release
    # 1. semantic release will bump versions in files -> we want this
    # 2. THEN it will try to commit to git -> we don't want this! -> we allow it to fail if it fails on the git commit
    - SEMANTIC_LOG=$(env -u GIT_AUTHOR_NAME -u GIT_AUTHOR_EMAIL -u GIT_COMMITTER_NAME -u GIT_COMMITTER_EMAIL semantic-release version 2>&1 || true)
    - |
      ALLOWED_GIT_ERROR="Cmd('git') failed due to: exit code(128)"
      if grep -q "${ALLOWED_GIT_ERROR}" <<< "${SEMANTIC_LOG}"; then
        echo "[+] Successfully parsed files using semantic release."
      else
        echo "${SEMANTIC_LOG}"
        exit 1
      fi
    - CHANGED_FILES=$(git diff --cached --name-status | cut -f2)
    - |
      if [ ! -z "${CHANGED_FILES}" ]; then
        echo -e "[+] The following files had their version changed:\n${CHANGED_FILES}"
      else
        echo "[!] No files were changed during versioning."
      fi
    # 3. all changed files are passed as artifacts to the next stages
    - GIT_COMMITTER_NAME=semantic-release GIT_COMMITTER_EMAIL=semantic-release semantic-release version ${EXTRA_ARGS}
  artifacts:
    paths:
      - ./*