.gitlab-ci.yml 1.34 KB
Newer Older
Maxime Lefrançois's avatar
Maxime Lefrançois committed
stages:
Maxime Lefrançois's avatar
Maxime Lefrançois committed
  # - build
  # - deploy
Maxime Lefrançois's avatar
Maxime Lefrançois committed
  - release
Maxime Lefrançois's avatar
Maxime Lefrançois committed
build:
  stage: build
Maxime Lefrançois's avatar
Maxime Lefrançois committed
  image: maven:3.6.2-jdk-8
Maxime Lefrançois's avatar
Maxime Lefrançois committed
  script:
    - mvn package
  artifacts:
    paths:
Maxime Lefrançois's avatar
Maxime Lefrançois committed
      - target/saref-pipeline.jar
Maxime Lefrançois's avatar
Maxime Lefrançois committed

Maxime Lefrançois's avatar
Maxime Lefrançois committed
deploy_package:
  stage: deploy
  script:
    - mvn deploy -s ci_settings.xml
    - echo VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) > target/build.env
  artifacts:
    reports:
      dotenv: target/build.env
  only:
    - develop-ci

release_job:
  stage: release
  image: registry.gitlab.com/gitlab-org/release-cli:latest
Maxime Lefrançois's avatar
Maxime Lefrançois committed
  only:
Maxime Lefrançois's avatar
Maxime Lefrançois committed
    - develop-ci
Maxime Lefrançois's avatar
Maxime Lefrançois committed
  needs: 
    - deploy_package
Maxime Lefrançois's avatar
Maxime Lefrançois committed
  script:
Maxime Lefrançois's avatar
Maxime Lefrançois committed
    - echo "Running the release job for $VERSION from commit $CI_COMMIT_SHA"
Maxime Lefrançois's avatar
Maxime Lefrançois committed
    - curl --location --output /usr/local/bin/release-cli "https://gitlab.com/api/v4/projects/gitlab-org%2Frelease-cli/packages/generic/release-cli/latest/release-cli-linux-amd64"
    - sudo chmod +x /usr/local/bin/release-cli
    - release-cli -v
    # - hostnamectl ; lsb_release -a ; cat /etc/os-release
Maxime Lefrançois's avatar
Maxime Lefrançois committed
  # release:
  #   tag_name: '$VERSION'
  #   description: '$CI_COMMIT_TAG_MESSAGE'
  #   ref: '$CI_COMMIT_SHA'
  #   assets:
  #     links:
  #       - name: 'saref-pipeline.jar'
  #         url: 'https://labs.etsi.org/rep/api/v4/projects/28/packages/maven/fr/mines-stetienne/ci/saref/saref-pipeline/$VERSION/saref-pipeline-$VERSION.jar'
  # bash: line 149: release-cli: command not found