Commit 52100504 authored by Ruben ten Hove's avatar Ruben ten Hove
Browse files

refactor: tbump cleaner jobs

parent 358bb888
Loading
Loading
Loading
Loading
+4 −6
Original line number Diff line number Diff line
@@ -8,14 +8,12 @@ include:
  - local: "python/tbump.yml"

tbump:
  before_script:
    - NEXT_RELEASE_VERSION=`cat .VERSION` || true
    - echo $NEXT_RELEASE_VERSION
  rules:
    - exists:
        - 'tbump.toml'
      # tbump does not work easily with versions not compliant with PEP440
      # e.g. v1.0.1-beta.1 is not PEP440 compliant
      # but it's the default used by semantic-release
      # as a temporary workaround we run tbump only on default branch
      if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
      exists:
        - tbump.toml
        - pyproject.toml
+4 −5
Original line number Diff line number Diff line
@@ -4,13 +4,12 @@ find-next-release:
  image: registry.gitlab.com/just-ci/images/node:latest
  script:
    - npm install -g semantic-release @semantic-release/exec
    - curl https://gitlab.com/just-ci/utils/-/raw/main/semantic-release/find-next-version.json > .releaserc
    - curl -sSLf https://gitlab.com/just-ci/utils/-/raw/main/semantic-release/find-next-version.json > .releaserc
    - semantic-release --dry-run --no-ci
    - NEXT_RELEASE_VERSION=`cat .VERSION` || true
    - echo $NEXT_RELEASE_VERSION
    - echo "TBUMP_NEXT_VERSION=$(cat .VERSION 2>/dev/null)" > TBUMP_NEXT_VERSION.env || true
  artifacts:
    paths:
      - .VERSION
    reports:
      dotenv: TBUMP_NEXT_VERSION.env
  only:
    variables:
      - $GL_TOKEN
+8 −7
Original line number Diff line number Diff line
@@ -8,19 +8,20 @@ tbump:
  image: registry.gitlab.com/just-ci/images/python:$PYVERSION
  stage: build
  script:
    - pip3 install tbump
    - |
      if [ -z ${NEXT_RELEASE_VERSION} ]
      then
        echo "NEXT_RELEASE_VERSION variable unset, will not tbump files"
      else
        echo "NEXT_RELEASE_VERSION is set to $NEXT_RELEASE_VERSION"
        tbump $NEXT_RELEASE_VERSION --only-patch --non-interactive
      if [ ! "${TBUMP_NEXT_VERSION}" = "" ]; then
        pip3 install tbump
        tbump ${TBUMP_NEXT_VERSION} --only-patch --non-interactive
        printf "BUMPED_FILES=" > bumped_files.env
        echo "$(git diff --name-only | tr '\n' ' ')" >> bumped_files.env
      else
        echo "[-] No new version will be released."
      fi
  artifacts:
    paths:
      - ./*
    exclude:
      - bumped_files.env
      - .git
    reports:
      dotenv: bumped_files.env