variables:
  DEPLOY_PATH: "F:/WisdomComponents"

stages:
  - init
  - bootstrap
  - build
  - release

before_script:
  - chcp 65001
  - echo 查看运行环境
  - whoami
  - node -v

init:
  stage: init
  script:
    - 'cd ${DEPLOY_PATH}/src/wisdom-components'
    - dir
    - git branch
    - git reset --hard origin/dev
    - git pull
    - npm install  --registry=https://g.civnet.cn:4873 --legacy-peer-deps

bootstrap:
  stage: bootstrap
  script:
    - 'cd ${DEPLOY_PATH}/src/wisdom-components'
    - dir

build:
  stage: build
  script:
    - 'cd ${DEPLOY_PATH}/src/wisdom-components'
    - echo 开始打包...
    - npm run site
    - echo 打包完成

release:
  stage: release
  script:
    - 'cd ${DEPLOY_PATH}/src/wisdom-components'
    - echo 开始拷贝发布包...
    - 'robocopy "${DEPLOY_PATH}/src/wisdom-components/dist" "${DEPLOY_PATH}/dist" /S ;
        IF ((${LASTEXITCODE} -le 8)) {cmd /c "exit /b 0"}'
    - echo 发布完成.
