default:
  image: docker.xiaogenban1993.com/node:13.11.0

before_script:
  - echo '====== 准备构建中 ========='

stages:
  - deploy

# 发布
job_deploy:
  only:
    - 00.StaryEvo
  stage: deploy
  tags:
  - staryEvo
  before_script:
    - echo '开始发布'
  script:
    - cd Assets/00.StaryEvo
     # 获取当前版本
    - CURRENT_VERSION=$(node -p "require('./package.json').version")
#    - echo " ProjectID ${CI_SERVER_HOST}"
#    - echo " ProjectID ${CI_PROJECT_ID}"
#    - echo " ProjectTOKEN ${CI_JOB_TOKEN}"
    - echo "registry=http://${SERVER_HOST}/npm" > .npmrc
    - echo "//${SERVER_HOST}/:_authToken=${AuthToken}" >> .npmrc
  # 版本存在检测
#    - if [[ "$REMOTE_VERSION" == *"$CURRENT_VERSION"* ]]; then
#        echo "版本 $CURRENT_VERSION 已存在，跳过发布";
#        exit 0;
#      fi
    - npm publish
    - echo '构建完成'
  when: 'on_success'
  retry: 0


after_script:
  - echo "====== 发布完成 ========="

