release.yml 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  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@v4
  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. ${{ secrets.NETDATA_RELEASE_TEST }}
  46. - name: Generate Nightly Changleog
  47. id: nightly-changelog
  48. if: steps.target.outputs.run == 'true' && steps.target.outputs.type == 'nightly'
  49. uses: heinrichreimer/github-changelog-generator-action@v2.4
  50. with:
  51. bugLabels: IGNOREBUGS
  52. excludeLabels: "stale,duplicate,question,invalid,wontfix,discussion,no changelog"
  53. issues: false
  54. sinceTag: v1.10.0
  55. token: ${{ secrets.NETDATABOT_GITHUB_TOKEN }}
  56. unreleasedLabel: "**Next release**"
  57. verbose: true
  58. maxIssues: 500
  59. - name: Generate Release Changelog
  60. id: release-changelog
  61. if: steps.target.outputs.run == 'true' && steps.target.outputs.type != 'nightly'
  62. uses: heinrichreimer/github-changelog-generator-action@v2.4
  63. with:
  64. bugLabels: IGNOREBUGS
  65. excludeLabels: "stale,duplicate,question,invalid,wontfix,discussion,no changelog"
  66. futureRelease: ${{ github.event.inputs.version }}
  67. issues: false
  68. sinceTag: v1.10.0
  69. token: ${{ secrets.NETDATABOT_GITHUB_TOKEN }}
  70. unreleasedLabel: "**Next release**"
  71. verbose: true
  72. maxIssues: 500
  73. - name: Commit Changes
  74. id: commit
  75. if: steps.target.outputs.run == 'true'
  76. env:
  77. GITHUB_TOKEN: ${{ secrets.NETDATABOT_GITHUB_TOKEN }}
  78. run: |
  79. git config user.name "netdatabot"
  80. git config user.email "bot@netdata.cloud"
  81. git add packaging/version CHANGELOG.md
  82. git commit -m "[ci skip] ${{ steps.target.outputs.message }}"
  83. if [ "${{ steps.target.outputs.type }}" != "nightly" ]; then
  84. git tag -a "${{ github.event.inputs.version }}" -m "${{ steps.target.outputs.message }}"
  85. fi
  86. if [ -n "${{ steps.target.outputs.new-branch }}" ]; then
  87. git branch "${{ steps.target.outputs.new-branch }}"
  88. fi
  89. git push --tags origin "${{ steps.target.outputs.branch }}"
  90. if [ -n "${{ steps.target.outputs.new-branch }}" ]; then
  91. git push origin "${{ steps.target.outputs.new-branch }}"
  92. fi
  93. - name: Failure Notification
  94. uses: rtCamp/action-slack-notify@v2
  95. env:
  96. SLACK_COLOR: 'danger'
  97. SLACK_FOOTER: ''
  98. SLACK_ICON_EMOJI: ':github-actions:'
  99. SLACK_TITLE: 'Failed to prepare changelog:'
  100. SLACK_USERNAME: 'GitHub Actions'
  101. SLACK_MESSAGE: |-
  102. ${{ github.repository }}: Failed to prepare changelog.
  103. Checkout: ${{ steps.checkout.outcome }}
  104. Prepare base ref: ${{ steps.target.outcome }}
  105. Generate nightly changelog: ${{ steps.nightly-changelog.outcome }}
  106. Generate release changelog: ${{ steps.release-changelog.outcome }}
  107. Commit changes: ${{ steps.commit.outcome }}
  108. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
  109. if: failure()
  110. trigger-artifacts:
  111. name: Trigger artifact builds
  112. runs-on: ubuntu-latest
  113. needs: update-changelogs
  114. if: needs.update-changelogs.outputs.run == 'true'
  115. steps:
  116. - name: Checkout
  117. id: checkout
  118. uses: actions/checkout@v4
  119. with:
  120. ref: ${{ needs.update-changelogs.outputs.ref }}
  121. - name: Trigger build
  122. id: trigger
  123. uses: benc-uk/workflow-dispatch@v1
  124. with:
  125. token: ${{ secrets.NETDATABOT_GITHUB_TOKEN }}
  126. repo: ${{ github.repository }}
  127. workflow: build.yml
  128. ref: ${{ needs.update-changelogs.outputs.ref }}
  129. inputs: '{"version": "${{ needs.update-changelogs.outputs.version }}", "type": "${{ needs.update-changelogs.outputs.type }}"}'
  130. - name: Failure Notification
  131. uses: rtCamp/action-slack-notify@v2
  132. env:
  133. SLACK_COLOR: 'danger'
  134. SLACK_FOOTER: ''
  135. SLACK_ICON_EMOJI: ':github-actions:'
  136. SLACK_TITLE: 'Failed to trigger ${{ needs.update-changelogs.outputs.type }} artifact builds:'
  137. SLACK_USERNAME: 'GitHub Actions'
  138. SLACK_MESSAGE: |-
  139. ${{ github.repository }}: Failed to trigger ${{ needs.update-changelogs.outputs.type }} artifact builds.
  140. Checkout: ${{ steps.checkout.outcome }}
  141. Trigger build: ${{ steps.trigger.outcome }}
  142. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
  143. if: failure()
  144. trigger-docker:
  145. name: Trigger docker builds
  146. runs-on: ubuntu-latest
  147. needs: update-changelogs
  148. if: needs.update-changelogs.outputs.run == 'true'
  149. steps:
  150. - name: Checkout
  151. id: checkout
  152. uses: actions/checkout@v4
  153. with:
  154. ref: ${{ needs.update-changelogs.outputs.ref }}
  155. - name: Trigger build
  156. id: trigger
  157. uses: benc-uk/workflow-dispatch@v1
  158. with:
  159. token: ${{ secrets.NETDATABOT_GITHUB_TOKEN }}
  160. repo: ${{ github.repository }}
  161. workflow: docker.yml
  162. ref: ${{ needs.update-changelogs.outputs.ref }}
  163. inputs: '{"version": "${{ needs.update-changelogs.outputs.version }}"}'
  164. - name: Failure Notification
  165. uses: rtCamp/action-slack-notify@v2
  166. env:
  167. SLACK_COLOR: 'danger'
  168. SLACK_FOOTER: ''
  169. SLACK_ICON_EMOJI: ':github-actions:'
  170. SLACK_TITLE: 'Failed to trigger ${{ needs.update-changelogs.outputs.type }} Docker builds:'
  171. SLACK_USERNAME: 'GitHub Actions'
  172. SLACK_MESSAGE: |-
  173. ${{ github.repository }}: Failed to trigger ${{ needs.update-changelogs.outputs.type }} Docker builds.
  174. Checkout: ${{ steps.checkout.outcome }}
  175. Trigger build: ${{ steps.trigger.outcome }}
  176. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
  177. if: failure()
  178. trigger-packages:
  179. name: Trigger package builds
  180. runs-on: ubuntu-latest
  181. needs: update-changelogs
  182. if: needs.update-changelogs.outputs.run == 'true'
  183. steps:
  184. - name: Checkout
  185. id: checkout
  186. uses: actions/checkout@v4
  187. with:
  188. ref: ${{ needs.update-changelogs.outputs.ref }}
  189. - name: Trigger build
  190. id: trigger
  191. uses: benc-uk/workflow-dispatch@v1
  192. with:
  193. token: ${{ secrets.NETDATABOT_GITHUB_TOKEN }}
  194. repo: ${{ github.repository }}
  195. workflow: packaging.yml
  196. ref: ${{ needs.update-changelogs.outputs.ref }}
  197. inputs: '{"version": "${{ needs.update-changelogs.outputs.version }}", "type": "${{ needs.update-changelogs.outputs.type }}"}'
  198. - name: Failure Notification
  199. uses: rtCamp/action-slack-notify@v2
  200. env:
  201. SLACK_COLOR: 'danger'
  202. SLACK_FOOTER: ''
  203. SLACK_ICON_EMOJI: ':github-actions:'
  204. SLACK_TITLE: 'Failed to trigger ${{ needs.update-changelogs.outputs.type }} package builds:'
  205. SLACK_USERNAME: 'GitHub Actions'
  206. SLACK_MESSAGE: |-
  207. ${{ github.repository }}: Failed to trigger ${{ needs.update-changelogs.outputs.type }} package builds.
  208. Checkout: ${{ steps.checkout.outcome }}
  209. Trigger build: ${{ steps.trigger.outcome }}
  210. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
  211. if: failure()