github-actions 插件

该插件用于在项目中创建 Github Action Workflows。

用例

下面的内容是一个示例配置文件用于创建 Github Workflows:

YAML

  1. tools:
  2. # name of the tool
  3. - name: github-actions
  4. # id of the tool instance
  5. instanceID: default
  6. # format: name.instanceID; If specified, dtm will make sure the dependency is applied first before handling this tool.
  7. dependsOn: [ ]
  8. # options for the plugin
  9. options:
  10. scm:
  11. # scm common field
  12. branch: YOUR_REPO_BRANCH
  13. token: YOUR_REPO_SCM_TOKEN
  14. # you can directly use the url of repo (git@github.com/root/test-exmaple.git for example)
  15. url: YOUR_REPO_URL
  16. # or you can config detailed fields for this repo
  17. owner: YOUR_REPO_OWNER
  18. org: YOUR_REPO_ORG
  19. name: YOUR_REPO_NAME
  20. scmType: github
  21. pipeline:
  22. # configLocation is the location of workflows, it can be remote or local address
  23. # if you don't config this field, devstream will use https://raw.githubusercontent.com/devstream-io/dtm-pipeline-templates/main/github-actions/workflows/main.yml
  24. configLocation: https://raw.githubusercontent.com/devstream-io/devstream/main/staging/dtm-github-action-example/general
  25. # language config is required
  26. language:
  27. framework: # support gin/flask/spring for now
  28. name: LANGUAGE # support go/java/nodejs/python for now
  29. imageRepo:
  30. # image repo URL for pulling/pushing
  31. url: http://harbor.example.com:80
  32. # image repo user name
  33. user: admin
  34. # image repo password
  35. password: YOUR_IMAGE_REPO_PASSWORD
  36. dingTalk:
  37. # dingtalk robot name
  38. name: YOUR_DINGTALK_ROBOT_NAME
  39. # dingtalk webhook
  40. webhook: https://oapi.dingtalk.com/robot/send?access_token=changemeByConfig
  41. # dingtalk securityType, we support "SECRET" and "KEY"
  42. securityType: YOUR_DINGTALK_SECRET_TYPE
  43. # dingtalk securityValue
  44. securityValue: YOUR_DINGTALK_SECRET_VALUE
  45. sonarqube:
  46. # sonarqube address
  47. url: http://sonar.example.com
  48. # sonarqube token
  49. token: YOUR_SONAR_TOKEN
  50. # sonarqube name in jenkins
  51. name: sonar_test

注意:

  • scm 配置字段用于表示代码仓库的配置信息,具体配置可查看SCM配置项
  • pipeline 选项项用于控制 CI 流程中的各个阶段,具体配置可查看文档pipline配置项