kind: pipeline
type: docker
# 流水线名称
name: crm_extend_cicd

volumes:
  - name: build_dist
    host:
      path: /www/wwwroot/crm_extend
clone:
  disable: true

steps:
  - name: clone
    image: alpine/git
    commands:
      - git clone --depth=1 -b develop --single-branch http://front:carlyle123@git.promocollection.com.au:11180/peter/crm_extend.git /drone/src
    when:
      branch:
        - develop
      event:
        - push

  - name: npm_run_build
    image: node:18.17.1-slim

    volumes:
      - name: build_dist
        path: /drone/src/build
    commands:
      - npm --registry=https://registry.npmmirror.com i
      - npm run build-test
      - rm -rf ./build/*
      - cp -arf ./dist/* ./build
      - ls build
      - ls dist
    when:
      branch:
        - develop
      event:
        - push