This GitLab CI configuration is valid. Learn more
.gitlab-ci.yml 2.63 KB
variables:
  TARGET_REPO_2021: "F:/CIV_CI/CivWebPublish2021_CIVWeb5/CivWebPublish2021/"
  TARGET_REPO_Solution: "F:/CIV_CI/PandaSolution/civbase/"
  TEMP_DIR: "F:/CIV_CI/tempV1/civbase/"
  GIT_STRATEGY: 'fetch'
  GIT_CHECKOUT: 'false'


before_script:
  - chcp 65001
  - 'git config core.autocrlf false'

stages:
  - refresh
  - install
  - package
  - push

refresh:
  stage: refresh
  tags:
    - civ_base
  script:
  - git reset --hard
  - git pull origin master
  - npm run update:wisdom
  # - 'git add . ; git commit --allow-empty -m "auto refresh civbase."'
  # - 'git push origin master'
  only:
    refs:
        - master
    variables:
        - $NPM_INSTALL == "true"
  when: manual

install:
  stage: install
  tags:
    - civ_base
  script:
  - git reset --hard
  - git pull origin master
  - npm run init
  #cache:
   # key: ${CI_COMMIT_REF_SLUG}
#    paths:
#    - node_modules/
  only:
    refs:
        - master
    variables:
        - $NPM_INSTALL == "true"
  when: manual

package:
  stage: package
  tags:
    - civ_base
  script:
  - echo "${CI_PROJECT_DIR}"
  - git pull origin master
  #- npm run init
  - npm run build --releasepath=F:\\CIV_CI\\tempV1
  #cache:
 #   key: ${CI_COMMIT_REF_SLUG}
  #  paths:
   #  - node_modules/
  only:
    - master
  allow_failure: false
  when: manual


pushSolution:
  variables:
    GIT_STRATEGY: none
  tags:
    - civ_base
  stage: push
  script:
  - 'cd "${TARGET_REPO_Solution}"'
  - 'git reset --hard head'
  - 'git clean -fd'
  - 'git remote set-url origin "https://${GIT_ACCESS_USER}:${GIT_ACCESS_PASSWORD}@g.civnet.cn:8443/PandaSolution/civbase.git"'
  - 'git pull origin master'
  - 'git rm -rf --ignore-unmatch "${TARGET_REPO_Solution}"'
  - 'robocopy "${TEMP_DIR}/" "${TARGET_REPO_Solution}" /S ;
        IF ((${LASTEXITCODE} -le 8)) {cmd /c "exit /b 0"}'
  - 'git add . ; git commit --allow-empty -m "auto package civbase."'
  - 'git push origin master'
  only:
    refs:
      - master
  when: on_success


push2021:
  variables:
    GIT_STRATEGY: none
  stage: push
  tags:
    - civ_base
  script:
  - 'cd "${TARGET_REPO_2021}"'
  - 'git reset --hard head'
  - 'git clean -fd'
  - 'git remote set-url origin "https://${GIT_ACCESS_USER}:${GIT_ACCESS_PASSWORD}@g.civnet.cn:8443/CivPublish/CivWebPublish2021.git"'
  - 'git pull origin map'
  - 'git rm -rf "${TARGET_REPO_2021}/civbase"'
  - 'robocopy "${TEMP_DIR}/" "${TARGET_REPO_2021}/civbase" /S ;
        IF ((${LASTEXITCODE} -le 8)) {cmd /c "exit /b 0"}'
  - 'git add . ; git reset HEAD Web.config CityInterface/Web.config CityWebFW/Web.config ; git commit --allow-empty -m "auto package civbase."'
  - 'git push origin map'
  only:
    - master
  when: manual