Commit 8123eb3d authored by Pantelis Malekas's avatar Pantelis Malekas
Browse files

feat: bump version

parent 190284fe
Loading
Loading
Loading
Loading
Loading
+58 −64
Changes for .gitlab-ci.yml: 58 added lines, 64 removed lines.
Original line number Diff line number Diff line
stages:
  - verify
  - prod_extract_next_release
  #- prod_package
  #- prod_release
  - prod_package
  - prod_release


default:
@@ -24,9 +24,6 @@ prod_extract_next_release_job:
  variables:
    GITLAB_TOKEN: $GROUP_ACCESS_TOKEN
  script:

    - echo "===== BEFORE ====="
    - git show-ref --tags v1.0.0 || true
    - DEV_RELEASE_VERSION=$(npx -y
      -p @semantic-release/commit-analyzer@9.0.2
      -p @semantic-release/git@10.0.1
@@ -39,71 +36,68 @@ prod_extract_next_release_job:
      semantic-release --dry-run | grep -oP '(?<=Published release ).*' | awk '{print $1}' || echo "no-release" )
    - echo "$DEV_RELEASE_VERSION" > dev_release_version.txt
    - cat dev_release_version.txt
    - echo "===== AFTER ====="
    - git show-ref --tags v1.0.0 || true
    - git ls-remote --tags origin v1.0.0
  artifacts:
    paths:
      - dev_release_version.txt
  only:
    - main

# prod_package_job:
#   stage: prod_package
#   image: labs.etsi.org:5050/osl/hypo/code/org.etsi.osl.hypo.ops/cicd/integration.tests/maven:3.8.3-openjdk-17
#   dependencies:
#     - prod_extract_next_release_job
#   script:
#     - DEV_RELEASE_VERSION=$(cat dev_release_version.txt)
#     - echo  $DEV_RELEASE_VERSION
#     - if [ "$DEV_RELEASE_VERSION" = "no-release" ]; then exit 0; fi
#     - chmod +x ./mvnw
#     - ./mvnw ${MAVEN_CLI_OPTS}  -q versions:set -DnewVersion=$DEV_RELEASE_VERSION
#     - ./mvnw ${MAVEN_CLI_OPTS} -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive exec:exec
#     - ./mvnw ${MAVEN_CLI_OPTS} deploy
#     - git add pom.xml
#     - git status
#     - git config --global user.email $GITLAB_USER_EMAIL
#     - git config --global user.name $GITLAB_USER_NAME
#     - |
#       if git commit -m "Release $DEV_RELEASE_VERSION: Update project version [skip ci]"; then
#         REPO_URL="${CI_SERVER_URL}/${CI_PROJECT_PATH}.git"
#         AUTH_REPO_URL="https://${GITLAB_USER_NAME}:${GROUP_ACCESS_TOKEN}@${REPO_URL#https://}"
#         git remote set-url origin "$AUTH_REPO_URL"
#         git push -f origin HEAD:main
prod_package_job:
  stage: prod_package
  image: labs.etsi.org:5050/osl/hypo/code/org.etsi.osl.hypo.ops/cicd/integration.tests/maven:3.8.3-openjdk-17
  dependencies:
    - prod_extract_next_release_job
  script:
    - DEV_RELEASE_VERSION=$(cat dev_release_version.txt)
    - echo  $DEV_RELEASE_VERSION
    - if [ "$DEV_RELEASE_VERSION" = "no-release" ]; then exit 0; fi
    - chmod +x ./mvnw
    - ./mvnw ${MAVEN_CLI_OPTS}  -q versions:set -DnewVersion=$DEV_RELEASE_VERSION
    - ./mvnw ${MAVEN_CLI_OPTS} -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive exec:exec
    - ./mvnw ${MAVEN_CLI_OPTS} deploy
    - git add pom.xml
    - git status
    - git config --global user.email $GITLAB_USER_EMAIL
    - git config --global user.name $GITLAB_USER_NAME
    - |
      if git commit -m "Release $DEV_RELEASE_VERSION: Update project version [skip ci]"; then
        REPO_URL="${CI_SERVER_URL}/${CI_PROJECT_PATH}.git"
        AUTH_REPO_URL="https://${GITLAB_USER_NAME}:${GROUP_ACCESS_TOKEN}@${REPO_URL#https://}"
        git remote set-url origin "$AUTH_REPO_URL"
        git push -f origin HEAD:main

#       else
#         echo "No changes to commit."
#       fi
#   artifacts:
#     paths:
#       - target/**
#   only:
#     - main
      else
        echo "No changes to commit."
      fi
  artifacts:
    paths:
      - target/**
  only:
    - main

# prod_semantic_versioning_job:
#   image: labs.etsi.org:5050/osl/hypo/code/org.etsi.osl.hypo.ops/cicd/integration.tests/node:lts
#   stage: prod_release
#   variables:
#     GITLAB_TOKEN: $GROUP_ACCESS_TOKEN
#   before_script:
#     - git pull origin HEAD
#   script:
#     - RELEASE_VERSION=$(npx -y
#       -p @semantic-release/commit-analyzer@9.0.2
#       -p @semantic-release/git@10.0.1
#       -p @semantic-release/gitlab@9.5.0
#       -p @semantic-release/release-notes-generator@10.0.3
#       -p @semantic-release/exec@6.0.3
#       -p @semantic-release/changelog@6.0.2
#       -p conventional-changelog-conventionalcommits@5.0.0
#       -p semantic-release@19.0.5
#       semantic-release | grep -oP '(?<=Published release ).*' | awk '{print $1}' || echo "no-release" )
#     - echo "$RELEASE_VERSION" > release_version.txt
#     - cat release_version.txt
#   artifacts:
#     paths:
#       - release_version.txt
#   only:
#     - main
prod_semantic_versioning_job:
  image: labs.etsi.org:5050/osl/hypo/code/org.etsi.osl.hypo.ops/cicd/integration.tests/node:lts
  stage: prod_release
  variables:
    GITLAB_TOKEN: $GROUP_ACCESS_TOKEN
  before_script:
    - git pull origin HEAD
  script:
    - RELEASE_VERSION=$(npx -y
      -p @semantic-release/commit-analyzer@9.0.2
      -p @semantic-release/git@10.0.1
      -p @semantic-release/gitlab@9.5.0
      -p @semantic-release/release-notes-generator@10.0.3
      -p @semantic-release/exec@6.0.3
      -p @semantic-release/changelog@6.0.2
      -p conventional-changelog-conventionalcommits@5.0.0
      -p semantic-release@19.0.5
      semantic-release | grep -oP '(?<=Published release ).*' | awk '{print $1}' || echo "no-release" )
    - echo "$RELEASE_VERSION" > release_version.txt
    - cat release_version.txt
  artifacts:
    paths:
      - release_version.txt
  only:
    - main