.gitlab-ci.yml 1.08 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
build:
  stage: build
  image: maven:3.8.6-openjdk-11
  script:
    - mvn package
  artifacts:
    paths:
      - 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
  image: maven:3.8.6-openjdk-11
Maxime Lefrançois's avatar
Maxime Lefrançois committed
  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:
    - master
Maxime Lefrançois's avatar
Maxime Lefrançois committed

release_job:
  stage: release
  image: registry.gitlab.com/gitlab-org/release-cli:latest
Maxime Lefrançois's avatar
Maxime Lefrançois committed
  only:
    - master
Maxime Lefrançois's avatar
Maxime Lefrançois committed
  needs: 
    - deploy_package
  script:
    - echo "Running the release job for $VERSION from commit $CI_COMMIT_SHA"
  release:
    tag_name: '$VERSION'
    description: 'Release $VERSION'
    ref: '$CI_COMMIT_SHA'
    assets:
      links:
        - name: 'saref-pipeline.jar'
          filepath: '/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'