variables:
    PORTAL_KEY: <my_private_key>

stages:
  - build
  - upload
  # - release

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
  only:
    - develop-ci
  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\"}"
