release.yml 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. ---
  2. # Workflow for triggering a release.
  3. name: Release
  4. on:
  5. schedule:
  6. - cron: '0 0 * * *'
  7. workflow_dispatch: # Dispatch runs build and validate, then push to the appropriate storage location.
  8. inputs:
  9. type:
  10. description: Build Type
  11. default: nightly
  12. required: true
  13. version:
  14. description: Version Tag
  15. default: nightly
  16. required: true
  17. concurrency: # This keeps multiple instances of the job from running concurrently for the same ref and event type.
  18. group: release-${{ github.ref }}-${{ github.event_name }}
  19. cancel-in-progress: true
  20. jobs:
  21. update-changelogs:
  22. name: Update changelog
  23. runs-on: ubuntu-latest
  24. outputs:
  25. ref: ${{ steps.target.outputs.ref }}
  26. version: ${{ steps.target.outputs.version }}
  27. type: ${{ steps.target.outputs.type }}
  28. run: ${{ steps.target.outputs.run }}
  29. steps:
  30. - name: Checkout
  31. id: checkout
  32. uses: actions/checkout@v2
  33. with:
  34. fetch-depth: 0
  35. submodules: recursive
  36. token: ${{ secrets.NETDATABOT_GITHUB_TOKEN }}
  37. - name: Prepare base ref
  38. id: target
  39. run: >-
  40. .github/scripts/prepare-release-base.sh \
  41. ${{ github.repository }} \
  42. ${{ github.event_name }} \
  43. ${{ github.event.inputs.type }} \
  44. ${{ github.event.inputs.version }}
  45. - name: Generate Nightly Changleog
  46. id: nightly-changelog
  47. if: steps.target.outputs.run == 'true' && steps.target.outputs.type == 'nightly'
  48. uses: heinrichreimer/github-changelog-generator-action@v2.3
  49. with:
  50. bugLabels: IGNOREBUGS
  51. excludeLabels: "stale,duplicate,question,invalid,wontfix,discussion,no changelog"
  52. issues: false
  53. sinceTag: v1.10.0
  54. token: ${{ secrets.NETDATABOT_GITHUB_TOKEN }}
  55. unreleasedLabel: "**Next release**"
  56. verbose: true
  57. maxIssues: 500
  58. - name: Generate Release Changelog
  59. id: release-changelog
  60. if: steps.target.outputs.run == 'true' && steps.target.outputs.type != 'nightly'
  61. uses: heinrichreimer/github-changelog-generator-action@v2.3
  62. with:
  63. bugLabels: IGNOREBUGS
  64. excludeLabels: "stale,duplicate,question,invalid,wontfix,discussion,no changelog"
  65. futureRelease: ${{ github.event.inputs.version }}
  66. issues: false
  67. sinceTag: v1.10.0
  68. token: ${{ secrets.NETDATABOT_GITHUB_TOKEN }}
  69. unreleasedLabel: "**Next release**"
  70. verbose: true
  71. maxIssues: 500
  72. - name: Commit Changes
  73. id: commit
  74. if: steps.target.outputs.run == 'true'
  75. env:
  76. GITHUB_TOKEN: ${{ secrets.NETDATABOT_GITHUB_TOKEN }}
  77. run: |
  78. git config user.name "netdatabot"
  79. git config user.email "bot@netdata.cloud"
  80. git add packaging/version CHANGELOG.md
  81. git commit -m "[ci skip] ${{ steps.target.outputs.message }}"
  82. if [ "${{ steps.target.outputs.type }}" != "nightly" ]; then
  83. git tag -a "${{ github.event.inputs.version }}" -m "${{ steps.target.outputs.message }}"
  84. fi
  85. if [ -n "${{ steps.target.outputs.new-branch }}" ]; then
  86. git branch "${{ steps.target.outputs.new-branch }}"
  87. fi
  88. git push --tags origin "${{ steps.target.outputs.branch }}"
  89. if [ -n "${{ steps.target.outputs.new-branch }}" ]; then
  90. git push origin "${{ steps.target.outputs.new-branch }}"
  91. fi
  92. - name: Failure Notification
  93. uses: rtCamp/action-slack-notify@v2
  94. env:
  95. SLACK_COLOR: 'danger'
  96. SLACK_FOOTER: ''
  97. SLACK_ICON_EMOJI: ':github-actions:'
  98. SLACK_TITLE: 'Failed to prepare changelog:'
  99. SLACK_USERNAME: 'GitHub Actions'
  100. SLACK_MESSAGE: |-
  101. ${{ github.repository }}: Failed to prepare changelog.
  102. Checkout: ${{ steps.checkout.outcome }}
  103. Prepare base ref: ${{ steps.target.outcome }}
  104. Generate nightly changelog: ${{ steps.nightly-changelog.outcome }}
  105. Generate release changelog: ${{ steps.release-changelog.outcome }}
  106. Commit changes: ${{ steps.commit.outcome }}
  107. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
  108. if: failure()
  109. trigger-artifacts:
  110. name: Trigger artifact builds
  111. runs-on: ubuntu-latest
  112. needs: update-changelogs
  113. if: ${{ needs.update-changelogs.outputs.run }} == 'true'
  114. steps:
  115. - name: Checkout
  116. id: checkout
  117. uses: actions/checkout@v2
  118. with:
  119. ref: ${{ needs.update-changelogs.outputs.ref }}
  120. - name: Trigger build
  121. id: trigger
  122. uses: benc-uk/workflow-dispatch@v1
  123. with:
  124. token: ${{ secrets.NETDATABOT_GITHUB_TOKEN }}
  125. repo: ${{ github.repository }}
  126. workflow: Build
  127. ref: ${{ needs.update-changelogs.outputs.ref }}
  128. inputs: '{"version": "${{ needs.update-changelogs.outputs.version }}", "type": "${{ needs.update-changelogs.outputs.type }}"}'
  129. - name: Failure Notification
  130. uses: rtCamp/action-slack-notify@v2
  131. env:
  132. SLACK_COLOR: 'danger'
  133. SLACK_FOOTER: ''
  134. SLACK_ICON_EMOJI: ':github-actions:'
  135. SLACK_TITLE: 'Failed to trigger ${{ needs.update-changelogs.outputs.type }} artifact builds:'
  136. SLACK_USERNAME: 'GitHub Actions'
  137. SLACK_MESSAGE: |-
  138. ${{ github.repository }}: Failed to trigger ${{ needs.update-changelogs.outputs.type }} artifact builds.
  139. Checkout: ${{ steps.checkout.outcome }}
  140. Trigger build: ${{ steps.trigger.outcome }}
  141. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
  142. if: failure()
  143. trigger-docker:
  144. name: Trigger docker builds
  145. runs-on: ubuntu-latest
  146. needs: update-changelogs
  147. if: ${{ needs.update-changelogs.outputs.run }} == 'true'
  148. steps:
  149. - name: Checkout
  150. id: checkout
  151. uses: actions/checkout@v2
  152. with:
  153. ref: ${{ needs.update-changelogs.outputs.ref }}
  154. - name: Trigger build
  155. id: trigger
  156. uses: benc-uk/workflow-dispatch@v1
  157. with:
  158. token: ${{ secrets.NETDATABOT_GITHUB_TOKEN }}
  159. repo: ${{ github.repository }}
  160. workflow: Docker
  161. ref: ${{ needs.update-changelogs.outputs.ref }}
  162. inputs: '{"version": "${{ needs.update-changelogs.outputs.version }}"}'
  163. - name: Failure Notification
  164. uses: rtCamp/action-slack-notify@v2
  165. env:
  166. SLACK_COLOR: 'danger'
  167. SLACK_FOOTER: ''
  168. SLACK_ICON_EMOJI: ':github-actions:'
  169. SLACK_TITLE: 'Failed to trigger ${{ needs.update-changelogs.outputs.type }} Docker builds:'
  170. SLACK_USERNAME: 'GitHub Actions'
  171. SLACK_MESSAGE: |-
  172. ${{ github.repository }}: Failed to trigger ${{ needs.update-changelogs.outputs.type }} Docker builds.
  173. Checkout: ${{ steps.checkout.outcome }}
  174. Trigger build: ${{ steps.trigger.outcome }}
  175. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
  176. if: failure()
  177. trigger-packages:
  178. name: Trigger package builds
  179. runs-on: ubuntu-latest
  180. needs: update-changelogs
  181. if: ${{ needs.update-changelogs.outputs.run }} == 'true'
  182. steps:
  183. - name: Checkout
  184. id: checkout
  185. uses: actions/checkout@v2
  186. with:
  187. ref: ${{ needs.update-changelogs.outputs.ref }}
  188. - name: Trigger build
  189. id: trigger
  190. uses: benc-uk/workflow-dispatch@v1
  191. with:
  192. token: ${{ secrets.NETDATABOT_GITHUB_TOKEN }}
  193. repo: ${{ github.repository }}
  194. workflow: Packages
  195. ref: ${{ needs.update-changelogs.outputs.ref }}
  196. inputs: '{"version": "${{ needs.update-changelogs.outputs.version }}", "type": "${{ needs.update-changelogs.outputs.type }}"}'
  197. - name: Failure Notification
  198. uses: rtCamp/action-slack-notify@v2
  199. env:
  200. SLACK_COLOR: 'danger'
  201. SLACK_FOOTER: ''
  202. SLACK_ICON_EMOJI: ':github-actions:'
  203. SLACK_TITLE: 'Failed to trigger ${{ needs.update-changelogs.outputs.type }} package builds:'
  204. SLACK_USERNAME: 'GitHub Actions'
  205. SLACK_MESSAGE: |-
  206. ${{ github.repository }}: Failed to trigger ${{ needs.update-changelogs.outputs.type }} package builds.
  207. Checkout: ${{ steps.checkout.outcome }}
  208. Trigger build: ${{ steps.trigger.outcome }}
  209. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
  210. if: failure()