branch-pipeline.yml 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. version: '1.0'
  2. name: branch-pipeline
  3. displayName: BranchPipeline
  4. stages:
  5. - stage:
  6. name: compile
  7. displayName: 编译
  8. steps:
  9. - step: build@nodejs
  10. name: build_nodejs
  11. displayName: Nodejs 构建
  12. # 支持8.16.2、10.17.0、12.16.1、14.16.0、15.12.0五个版本
  13. nodeVersion: 14.16.0
  14. # 构建命令:安装依赖 -> 清除上次打包产物残留 -> 执行构建 【请根据项目实际产出进行填写】
  15. commands:
  16. - npm install && rm -rf ./dist && npm run build
  17. # 非必填字段,开启后表示将构建产物暂存,但不会上传到制品库中,7天后自动清除
  18. artifacts:
  19. # 构建产物名字,作为产物的唯一标识可向下传递,支持自定义,默认为BUILD_ARTIFACT。在下游可以通过${BUILD_ARTIFACT}方式引用来获取构建物地址
  20. - name: BUILD_ARTIFACT
  21. # 构建产物获取路径,是指代码编译完毕之后构建物的所在路径
  22. path:
  23. - ./dist
  24. - step: publish@general_artifacts
  25. name: publish_general_artifacts
  26. displayName: 上传制品
  27. # 上游构建任务定义的产物名,默认BUILD_ARTIFACT
  28. dependArtifact: BUILD_ARTIFACT
  29. # 上传到制品库时的制品命名,默认output
  30. artifactName: output
  31. dependsOn: build_nodejs
  32. - stage:
  33. name: release
  34. displayName: 发布
  35. steps:
  36. - step: publish@release_artifacts
  37. name: publish_release_artifacts
  38. displayName: '发布'
  39. # 上游上传制品任务的产出
  40. dependArtifact: output
  41. # 发布制品版本号
  42. version: '1.0.0.0'
  43. # 是否开启版本号自增,默认开启
  44. autoIncrement: true
  45. triggers:
  46. push:
  47. branches:
  48. exclude:
  49. - master
  50. include:
  51. - .*