version: '1.0'
name: test
displayName: 输出
triggers:
  trigger: auto
  push:
    branches:
      include:
        - master
stages:
  - name: compile
    displayName: 编译
    strategy: naturally
    trigger: auto
    steps:
      - step: build@nodejs
        name: build_nodejs
        displayName: Nodejs 构建
        nodeVersion: 14.16.0
        commands:
          - echo "假装在构建"
        artifacts:
          - name: BUILD_ARTIFACT
            path:
              - ./dist
        strategy: {}
      - step: publish@general_artifacts
        name: publish_general_artifacts
        displayName: 上传制品
        dependArtifact: BUILD_ARTIFACT
        artifactName: output
        strategy: {}
        dependsOn: build_nodejs
  - name: release
    displayName: 发布
    strategy: naturally
    trigger: auto
    steps:
      - step: publish@release_artifacts
        name: publish_release_artifacts
        displayName: 发布
        dependArtifact: output
        version: 1.0.0.0
        autoIncrement: true
        strategy: {}
  - name: stage-14a2cd9a
    displayName: 去到window操作
    strategy: naturally
    trigger: auto
    executor: []
    steps:
      - step: deploy@agent
        name: deploy_agent
        displayName: 主机部署
        hostGroupID:
          ID: label
          hostID:
            - caa8def7-891e-438f-ba62-45cd6b983e8a
        deployArtifact:
          - source: artifact
            name: output
            target: d:/project1
            artifactRepository: release
            artifactName: output
            artifactVersion: latest
        script:
          - '# 功能：部署脚本会在部署主机组的每台机器上执行'
          - '# 使用场景：先将制品包解压缩到指定目录中，再执行启动脚本deploy.sh，脚本示例地址：https://gitee.com/gitee-go/spring-boot-maven-deploy-case/blob/master/deploy.sh'
          - echo 'Hello Gitee!'
          - cd /d d:/project1
          - tar -zxf output.tar.gz
        notify: []
        strategy:
          retry: '0'
