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