forked from githubtraining/release-workflow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.yml
412 lines (396 loc) · 14.5 KB
/
config.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
title: Create a release based workflow
tagline: Learn and practice a workflow based around creating releases on GitHub.
description: This course focuses on releases, and more complex branching strategies.
tags:
- GitHub
template:
name: release-based-workflow
repo: AlienInvasion
before:
# enable branch protection
- type: updateBranchProtection
- type: updateBranchProtection
branch: release-v1.0
# creating a welcome issue that will have the user's first instructions
- type: createIssue
title: Welcome
body: 00.1_welcome.md
data:
releases: "%payload.repository.html_url%/releases"
steps:
#1 - ask the user to create a beta release from the most recent commit on master
- title: Create a beta release
description: Create a beta release, or a pre-release, from the existing codebase.
event: release.published
link: "{{ repoUrl }}/issues/1"
actions:
# creates an issue with the next instructions about project boards
- type: createIssue
title: Organizing a release
body: 01.1_project-board.md
action_id: trackingIssue
data:
projects: "%payload.repository.html_url%/projects"
# responding in the first welcome issue, pointing the user to the next issue just created
- type: respond
issue: Welcome
with: 01.2_next-step.md
data:
url: "%actions.trackingIssue.data.html_url%"
releases: "{{ repoUrl }}/releases"
# closes the welcome issue
- type: closeIssue
issue: Welcome
#2 - The user should create a project board
- title: Create a project board
description: Prepare for the next release using GitHub Projects.
event: project.created
link: "{{ repoUrl }}/issues/2"
actions:
- type: respond
issue: Organizing a release
with: 02.1_move-a-card.md
data:
projects: '%payload.repository.html_url%/projects'
#3 - The user should add a card to the project board
- title: Triage issues in a project
description: Add an issue to a project column.
event: project_card.created
link: "{{ repoUrl }}/issues/2"
actions:
# check if the project card is an issue (if not, it's one of the automated cards)
- type: gate
left: "%payload.project_card.content_url%"
- type: createIssue
title: Adding a feature
body: 03.1_update-readme.md
action_id: addFeature
- type: respond
with: 03.2_automation.md
issue: Organizing a release
data:
url: "%actions.addFeature.data.html_url%"
- type: closeIssue
issue: Organizing a release
#4 - User makes a change and opens a pull request against `base: release-v1.0`
- title: Add a new feature on the release branch
description: Update the README.md and open a pull request.
event: pull_request
link: "{{ repoUrl }}/issues/3"
actions:
# We make sure that the user's pull request has the base set to `release-v1.0`
- type: gate
gates:
- left: "%payload.action%"
operator: ===
right: edited
- left: "%payload.action%"
operator: ===
right: opened
- type: gate
left: "%payload.pull_request.base.ref%"
operator: ===
right: release-v1.0
else:
- type: respond
with: 04.1_wrong-base.md
# We approve their pull request
- type: createReview
body: 04.2_approval.md
event: APPROVE
#5 - The user merges their pull request into the release branch
- title: Merge the new feature to the release branch
description: Merge the pull request to update the release branch.
event: pull_request.closed
link: "{{ repoUrl }}/pull/4"
actions:
# Because the event is the same for both, we make sure that the pull request is merged, and not just closed.
- type: gate
left: "%payload.pull_request.merged%"
# If the pull request was closed with unmerged commits...
else:
# We reopen the pull request
- type: octokit
method: issues.edit
state: open
owner: "%payload.repository.owner.login%"
repo: "%payload.repository.name%"
number: "%payload.repository.pull_request.number%"
# We comment and let them know that they should merge
- type: respond
with: 05.1_early-close.md
# If the user does everything right, we create the next issue with instructions to create a pull request from the release branch into master
- type: createIssue
title: Create a release pull request
body: 05.2_release-pr.md
action_id: releaseIssue
data:
prUrl: "%payload.repository.html_url%/compare/master...release-v1.0?expand=1"
# We comment in the merged pull request, and point them to the new issue with instructions
- type: respond
with: 05.3_response.md
data:
url: "%actions.releaseIssue.data.html_url%"
# We re-enable branch protection on the release branch
- type: closeIssue
issue: Adding a feature
#6 - The user opens a pull request from the release branch into master
- title: Open a release pull request
description: Create a pull request to bring the new feature into master.
event: pull_request
link: "{{ repoUrl }}/issues/5"
actions:
# We check that the pull request has the correct "base" and "compare"
- type: gate
gates:
- left: "%payload.action%"
operator: ===
right: edited
- left: "%payload.action%"
operator: ===
right: opened
- type: gate
gates:
- left: "%payload.pull_request.base.ref%"
operator: ===
right: master
- left: "%payload.pull_request.head.ref%"
operator: ===
right: release-v1.0
every: true
else:
- type: respond
with: 06.1_wrong-base.md
- type: gate
left: "%payload.pull_request.title%"
operator: ===
right: Release v1.0
else:
- type: respond
with: 06.4_change-title.md
# If they did everything right, we create a new pull request going into the release branch.
# Currently the change is very minor, but it should make sense with the release.
# TODO: remove addition of release drafter config from `green-colors` PR, this is added at a later point
- type: createPullRequest
title: More features for the next release
body: 06.2_new-pr.md
head: green-colors
base: release-v1.0
action_id: morefeaturesPR
- type: respond
with: 06.3_successful-open.md
data:
url: "%actions.morefeaturesPR.data.html_url%"
- type: closeIssue
issue: Create a release pull request
- type: requestReviewFromRegistrant
pullRequest: More features for the next release
#7 - Bot creates a PR against release, learner approves
- title: Approve changes for the next release
description: Approve pull request changes for an upcoming release.
event: pull_request_review.submitted
link: "{{ repoUrl }}/pull/7"
actions:
- type: mergePullRequest
- type: octokit
method: gitdata.deleteReference
owner: "%payload.repository.owner.login%"
repo: "%payload.repository.name%"
ref: heads/green-colors
- type: getPullRequest
pullRequest: Release v1.0
action_id: releasePr
- type: respond
with: 07.1_github-app.md
issue: "%actions.releasePr.data.number%"
data:
prUrl: "%payload.repository.html_url%/compare/release-v1.0...config-release-drafter?expand=1"
- type: respond
with: 07.2_back-to-release.md
data:
url: "%actions.releasePr.data.html_url%"
#8 - Install the GitHub app and then populate the release-drafter.yml file
- title: Install and configure a GitHub app
description: Use the Release Drafter GitHub app to help with release notes.
event: pull_request
link: "{{ repoUrl }}/pull/6"
actions:
# We check that the pull request has the correct "base" and "compare"
- type: gate
gates:
- left: "%payload.action%"
operator: ===
right: edited
- left: "%payload.action%"
operator: ===
right: opened
- type: gate
gates:
- left: "%payload.pull_request.base.ref%"
operator: ===
right: release-v1.0
- left: "%payload.pull_request.head.ref%"
operator: ===
right: config-release-drafter
every: true
else:
- type: respond
with: 08.1_wrong-base.md
- type: octokit
method: pullRequests.getFiles
owner: "%payload.repository.owner.login%"
repo: "%payload.repository.name%"
number: "%payload.pull_request.number%"
action_id: pr_file
- type: gate
left: "%actions.pr_file.data%"
operator: includes
right: "filename:.github/release-drafter.yml"
else:
- type: respond
with: 08.2_config-validation.md
- type: createReview
body: 08.3_merge-the-config.md
event: APPROVE
#9 - Merge the release drafter configuration
- title: Merge the config for Release Drafter
description: Merge the configuration file for Release Drafter to set a template for the release.
event: pull_request.closed
link: "{{ repoUrl }}/pull/8"
actions:
- type: getPullRequest
pullRequest: Release v1.0
action_id: releasePr
- type: respond
with: 09.1_goto-release.md
data:
url: "%actions.releasePr.data.html_url%"
- type: createReview
body: 09.2_response.md
event: APPROVE
pullRequest: Release v1.0
#10 - The user approves the branch merge into master
- title: Merge the release branch
description: Merge the release branch into master.
event: pull_request.closed
link: "{{ repoUrl }}/pull/6"
actions:
# Because the event is the same for both, we make sure that the pull request is merged, and not just closed.
- type: gate
left: "%payload.pull_request.merged%"
# If the pull request was closed with unmerged commits...
else:
# We reopen the pull request
- type: octokit
method: issues.edit
state: open
owner: "%payload.repository.owner.login%"
repo: "%payload.repository.name%"
number: "%payload.repository.pull_request.number%"
# We comment and let them know that they should merge
- type: respond
with: 10.1_early-close.md
# We create a new issue asking them to turn the draft release into a published release
- type: createIssue
title: Finalize the release
body: 10.2_finalize-release.md
data:
releases: "%payload.repository.html_url%/releases"
action_id: finalIssue
# We comment in the merged pull request, pointing users to final instructions
- type: respond
with: 10.3_nice-merge.md
data:
url: "%actions.finalIssue.data.html_url%"
#11 - User creates a release from the draft
- title: Finalize the release
description: Complete the release by publishing the drafted release.
event: release.published
link: "{{ repoUrl }}/issues/9"
actions:
## Create a new PR for the hotfix
- type: createPullRequest
title: Accidental bugs
body: 11.1_hotfix-intro.md
head: bug-fix
base: master
action_id: newPullRequest
- type: assignRegistrant
issue: "%actions.newPullRequest.data.number%"
## Suggest a change in the new PR
- type: octokit
method: pullRequests.createComment
owner: "%payload.repository.owner.login%"
repo: "%payload.repository.name%"
number: "%actions.newPullRequest.data.number%"
commit_id: "%actions.newPullRequest.data.head.sha%"
path: game.js
body: |
How's this change?
```suggestion
starCtx.fillStyle = "#000";
```
For more information about suggest changes, check out this [GitHub Help](https://help.github.com/articles/incorporating-feedback-in-your-pull-request) article.
position: 5
- type: requestReviewFromRegistrant
pullRequest: Accidental bugs
- type: respond
with: 11.2_next-bug.md
issue: Finalize the release
data:
url: "%actions.newPullRequest.data.html_url%"
- type: closeIssue
issue: Finalize the release
#12 - User resolves the bug, then approves the pull request and it is merged into master
- title: Approve a hotfix pull request
description: Submit a hotfix to a previous release.
event: pull_request_review.submitted
link: "{{ repoUrl }}/pull/10"
actions:
- type: updateBranchProtection
branch: bug-fix
- type: mergePullRequest
- type: createPullRequest
title: Backport the hotfix
body: 12.1_backport.md
head: bug-fix
base: release-v1.0
action_id: backportPR
- type: respond
with: 12.2_fix-merged.md
data:
url: "%actions.backportPR.data.html_url%"
#13 - Hotfix is reverse merged into the release branch
- title: Approve the backport pull request
description: Backport the patch commits to the release branch.
event: pull_request_review.submitted
link: "{{ repoUrl }}/pull/11"
actions:
- type: mergePullRequest
- type: createIssue
title: Create a patch release
body: 13.1_last-release.md
data:
releases: "%payload.repository.html_url%"
action_id: patchIssue
- type: respond
with: 13.2_backport-shipped.md
data:
url: "%actions.patchIssue.data.html_url%"
#14 - Backport the hotfix into existing release
- title: Create release v1.0.1
description: Create a patch release based on the most recent commit on the release branch.
event: release.published
link: "{{ repoUrl }}/issues/12"
actions:
- type: createIssue
title: Congratulations
body: 14.1_congratulations.md
action_id: lastIssue
- type: respond
with: 14.2_point-to-last.md
issue: Create a patch release
data:
url: "%actions.lastIssue.data.html_url%"
- type: closeIssue
issue: Create a patch release