Commit c1eff535 authored by Jerome Chauveau's avatar Jerome Chauveau
Browse files

test ci

parent 44f92d8d
Loading
Loading
Loading
Loading

.gitlab-ci.yml

0 → 100644
+46 −0
Original line number Diff line number Diff line
stages:
  - build
  - upload
  - release

variables:
#  PACKAGE_VERSION: "1.0.0"
#  ASSET: "test_ci-${PACKAGE_VERSION}-release.txt"
  PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/MaX/${PACKAGE_VERSION}"

build:
  stage: build
  image: node:latest
  rules:
    - if: $CI_COMMIT_TAG
  script:
    - MAX_VERSION=$(node -p -e "require('./package.json').version")
    - ASSET="max-V${PACKAGE_VERSION}.zip"
    - cd tools
    - ./build.sh
    - mv $ASSET dist/
    - ls dist
  artifacts:
    paths:
      - dist/

upload:
  stage: upload
  image: curlimages/curl:latest
  rules:
    - if: $CI_COMMIT_TAG
  script:
    - |
      curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file dist/${ASSET} "${PACKAGE_REGISTRY_URL}/${ASSET}"

release:
  # Caution, as of 2021-02-02 these assets links require a login, see:
  # https://gitlab.com/gitlab-org/gitlab/-/issues/299384
  stage: release
  image: registry.gitlab.com/gitlab-org/release-cli:latest
  rules:
    - if: $CI_COMMIT_TAG
  script:
    - |
      release-cli create --name "Release $CI_COMMIT_TAG" --tag-name $CI_COMMIT_TAG \
        --assets-link "{\"name\":\"${ASSET}\",\"url\":\"${PACKAGE_REGISTRY_URL}/${ASSET}\"}"