Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
.gitlab-ci.yml 2.02 KiB
Newer Older
Raphael JOIE's avatar
wip
Raphael JOIE committed
workflow:
  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
      when: never
      # Don't run on first init commit of a branch
    - if: $CI_COMMIT_BRANCH && $CI_COMMIT_BEFORE_SHA == "0000000000000000000000000000000000000000"
      when: never
    - if: $CI_COMMIT_BRANCH

stages:
  - build
  - deliver

build:
  image: node:20
  tags:
    - docker
    - lab
  stage: build
  script:
    - npm install
    - npm run build
  artifacts:
    paths:
      - dist

deliver-umd:
  image: node:20
  tags:
    - docker
    - lab
  stage: deliver
  script:
    - PACKAGE_VERSION=$(node -e "const c = require('./package.json'); console.log(c.version)")
    - echo ${PACKAGE_VERSION}
    - 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --header "Content-Type: text/javascript" --upload-file dist/umd/index.js "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/application-landscape-viewer/latest/index.js"'
    - 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --header "Content-Type: text/css" --upload-file dist/umd/assets/styles.css "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/application-landscape-viewer/latest/styles.css"'
    - 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --header "Content-Type: text/javascript " --upload-file dist/umd/index.js "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/application-landscape-viewer/${PACKAGE_VERSION}/index.js"'
    - 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --header "Content-Type: text/css" --upload-file dist/umd/assets/styles.css "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/application-landscape-viewer/${PACKAGE_VERSION}/styles.css"'
  needs:
    - build
  dependencies:
    - build

deliver-package:
  image: node:20
  tags:
    - docker
    - lab
  stage: deliver
  script:
    - echo "registry=https://${CI_SERVER_HOST}/api/v4/projects/${CI_PROJECT_ID}/packages/npm/" > .npmrc
    - echo "//${CI_SERVER_HOST}/api/v4/projects/${CI_PROJECT_ID}/packages/npm/:_authToken=${CI_JOB_TOKEN}" >> .npmrc
    - npm publish
  needs:
    - build
  dependencies:
    - build