Unverified Commit 9a68fbcd authored by Maxime Lefrançois's avatar Maxime Lefrançois
Browse files

test release

parent 1fd56c8a
Loading
Loading
Loading
Loading
+28 −20
Original line number Diff line number Diff line
@@ -2,36 +2,44 @@ variables:
    PORTAL_KEY: <my_private_key>

stages:
  - build
  - upload
  # - release
  # - build
  - deploy_package
  - release_job

build:
  stage: build
  image: maven:3.6.2-jdk-8
  only:
    - develop-ci
  script:
    - mvn package
  artifacts:
    paths:
      - target/saref-pipeline.jar

upload:
  stage: upload
  image: curlimages/curl:latest
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
  only:
    - develop-ci
  needs: 
    - deploy_package
  script:
    - |
      echo curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file target/saref-pipeline.jar "${PACKAGE_REGISTRY_URL}/saref-pipeline.jar"

# release:
#   stage: release
#   image: registry.gitlab.com/gitlab-org/release-cli:latest
#   only:
#     - develop-ci
#   script:
#     - |
#       release-cli create --name "Release $CI_COMMIT_SHA" --ref $CI_COMMIT_SHA \
#         --assets-link "{\"name\":\"saref-pipeline.jar\",\"url\":\"${PACKAGE_REGISTRY_URL}/saref-pipeline.jar\"}"
    - echo "Running the release job for $VERSION from commit $CI_COMMIT_SHA"
  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'

ci_settings.xml

0 → 100644
+16 −0
Original line number Diff line number Diff line
<settings xmlns="http://maven.apache.org/SETTINGS/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
  <servers>
    <server>
      <id>gitlab-maven</id>
      <configuration>
        <httpHeaders>
          <property>
            <name>Job-Token</name>
            <value>${CI_JOB_TOKEN}</value>
          </property>
        </httpHeaders>
      </configuration>
    </server>
  </servers>
</settings>