-
Notifications
You must be signed in to change notification settings - Fork 887
260 lines (220 loc) · 9.41 KB
/
prepare-release.yml
File metadata and controls
260 lines (220 loc) · 9.41 KB
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
name: Prepare for a release
on:
workflow_dispatch:
inputs:
tag-prefix:
type: choice
options:
- core-
- coreunstable-
description: 'Release tag prefix'
required: true
version:
type: string
description: 'Release version'
required: true
pull_request:
types:
- closed
issue_comment:
types:
- created
permissions:
contents: read
jobs:
automation:
uses: ./.github/workflows/automation.yml
secrets:
OTELBOT_DOTNET_PRIVATE_KEY: ${{ secrets.OTELBOT_DOTNET_PRIVATE_KEY }}
prepare-release-pr:
runs-on: ubuntu-24.04
needs: automation
if: github.event_name == 'workflow_dispatch' && needs.automation.outputs.enabled
steps:
- uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1
id: otelbot-token
with:
app-id: ${{ vars.OTELBOT_DOTNET_APP_ID }}
private-key: ${{ secrets.OTELBOT_DOTNET_PRIVATE_KEY }}
- name: Check out code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
token: ${{ steps.otelbot-token.outputs.token }}
- name: Create GitHub Pull Request to prepare release
shell: pwsh
env:
GH_TOKEN: ${{ steps.otelbot-token.outputs.token }}
BOT_USER_EMAIL: ${{ needs.automation.outputs.email }}
BOT_USER_NAME: ${{ needs.automation.outputs.username }}
COMMENT_USER_NAME: ${{ github.event.sender.login }}
TAG_PREFIX: ${{ inputs.tag-prefix }}
VERSION: ${{ inputs.version }}
run: |
Import-Module .\build\scripts\prepare-release.psm1
CreatePullRequestToUpdateChangelogsAndPublicApis `
-gitRepository ${env:GITHUB_REPOSITORY} `
-minVerTagPrefix ${env:TAG_PREFIX} `
-version ${env:VERSION} `
-requestedByUserName ${env:COMMENT_USER_NAME} `
-targetBranch ${env:GITHUB_REF_NAME} `
-gitUserName ${env:BOT_USER_NAME} `
-gitUserEmail ${env:BOT_USER_EMAIL}
lock-pr-and-post-notice-to-create-release-tag:
runs-on: ubuntu-24.04
needs: automation
if: |
github.event_name == 'pull_request' &&
github.event.action == 'closed' &&
github.event.pull_request.user.login == needs.automation.outputs.application-username &&
github.event.pull_request.merged == true &&
startsWith(github.event.pull_request.title, '[release] Prepare release ') &&
needs.automation.outputs.enabled
steps:
- uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1
id: otelbot-token
with:
app-id: ${{ vars.OTELBOT_DOTNET_APP_ID }}
private-key: ${{ secrets.OTELBOT_DOTNET_PRIVATE_KEY }}
- name: Check out code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
token: ${{ steps.otelbot-token.outputs.token }}
- name: Lock GitHub Pull Request to prepare release
shell: pwsh
env:
GH_TOKEN: ${{ steps.otelbot-token.outputs.token }}
EXPECTED_PR_AUTHOR_USER_NAME: ${{ needs.automation.outputs.application-name }}
ISSUE_NUMBER: ${{ github.event.pull_request.number }}
run: |
Import-Module .\build\scripts\prepare-release.psm1
LockPullRequestAndPostNoticeToCreateReleaseTag `
-gitRepository ${env:GITHUB_REPOSITORY} `
-pullRequestNumber ${env:ISSUE_NUMBER} `
-expectedPrAuthorUserName ${env:EXPECTED_PR_AUTHOR_USER_NAME}
create-release-tag-pr-post-notice:
runs-on: ubuntu-24.04
needs: automation
if: |
github.event_name == 'issue_comment' &&
github.event.issue.pull_request &&
github.event.issue.locked == true &&
github.event.comment.user.login != needs.automation.outputs.application-username &&
contains(github.event.comment.body, '/CreateReleaseTag') &&
startsWith(github.event.issue.title, '[release] Prepare release ') &&
github.event.issue.pull_request.merged_at &&
needs.automation.outputs.enabled
steps:
- uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1
id: otelbot-token
with:
app-id: ${{ vars.OTELBOT_DOTNET_APP_ID }}
private-key: ${{ secrets.OTELBOT_DOTNET_PRIVATE_KEY }}
- name: Check out code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
# Note: By default GitHub only fetches 1 commit which fails the git tag operation below
fetch-depth: 0
token: ${{ steps.otelbot-token.outputs.token }}
- name: Create release tag
id: create-tag
shell: pwsh
env:
GH_TOKEN: ${{ steps.otelbot-token.outputs.token }}
BOT_USER_EMAIL: ${{ needs.automation.outputs.email }}
BOT_USER_NAME: ${{ needs.automation.outputs.username }}
EXPECTED_PR_AUTHOR_USER_NAME: ${{ needs.automation.outputs.application-name }}
ISSUE_NUMBER: ${{ github.event.issue.number }}
run: |
Import-Module .\build\scripts\prepare-release.psm1
CreateReleaseTagAndPostNoticeOnPullRequest `
-gitRepository ${env:GITHUB_REPOSITORY} `
-pullRequestNumber ${env:ISSUE_NUMBER} `
-expectedPrAuthorUserName ${env:EXPECTED_PR_AUTHOR_USER_NAME} `
-gitUserName ${env:BOT_USER_NAME} `
-gitUserEmail ${env:BOT_USER_EMAIL}
update-changelog-release-dates-on-prepare-pr-post-notice:
runs-on: ubuntu-24.04
needs: automation
if: |
github.event_name == 'issue_comment' &&
github.event.issue.pull_request &&
github.event.issue.state == 'open' &&
github.event.comment.user.login != needs.automation.outputs.application-username &&
contains(github.event.comment.body, '/UpdateReleaseDates') &&
startsWith(github.event.issue.title, '[release] Prepare release ') &&
github.event.issue.pull_request.merged_at == null &&
needs.automation.outputs.enabled
steps:
- uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1
id: otelbot-token
with:
app-id: ${{ vars.OTELBOT_DOTNET_APP_ID }}
private-key: ${{ secrets.OTELBOT_DOTNET_PRIVATE_KEY }}
- name: Check out code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
# Note: By default GitHub only fetches 1 commit which fails the git tag operation below
fetch-depth: 0
token: ${{ steps.otelbot-token.outputs.token }}
- name: Update release date
shell: pwsh
env:
GH_TOKEN: ${{ steps.otelbot-token.outputs.token }}
BOT_USER_EMAIL: ${{ needs.automation.outputs.email }}
BOT_USER_NAME: ${{ needs.automation.outputs.username }}
EXPECTED_PR_AUTHOR_USER_NAME: ${{ needs.automation.outputs.application-name }}
COMMENT_USER_NAME: ${{ github.event.comment.user.login }}
ISSUE_NUMBER: ${{ github.event.issue.number }}
run: |
Import-Module .\build\scripts\prepare-release.psm1
UpdateChangelogReleaseDatesAndPostNoticeOnPullRequest `
-gitRepository ${env:GITHUB_REPOSITORY} `
-pullRequestNumber ${env:ISSUE_NUMBER} `
-expectedPrAuthorUserName ${env:EXPECTED_PR_AUTHOR_USER_NAME} `
-commentUserName ${env:COMMENT_USER_NAME} `
-gitUserName ${env:BOT_USER_NAME} `
-gitUserEmail ${env:BOT_USER_EMAIL}
update-releasenotes-on-prepare-pr-post-notice:
runs-on: ubuntu-24.04
needs: automation
if: |
github.event_name == 'issue_comment' &&
github.event.issue.pull_request &&
github.event.issue.state == 'open' &&
github.event.comment.user.login != needs.automation.outputs.application-username &&
contains(github.event.comment.body, '/UpdateReleaseNotes') &&
startsWith(github.event.issue.title, '[release] Prepare release ') &&
github.event.issue.pull_request.merged_at == null &&
needs.automation.outputs.enabled
steps:
- uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1
id: otelbot-token
with:
app-id: ${{ vars.OTELBOT_DOTNET_APP_ID }}
private-key: ${{ secrets.OTELBOT_DOTNET_PRIVATE_KEY }}
- name: Check out code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
# Note: By default GitHub only fetches 1 commit which fails the git tag operation below
fetch-depth: 0
token: ${{ steps.otelbot-token.outputs.token }}
- name: Update release notes
env:
GH_TOKEN: ${{ steps.otelbot-token.outputs.token }}
BOT_USER_EMAIL: ${{ needs.automation.outputs.email }}
BOT_USER_NAME: ${{ needs.automation.outputs.username }}
EXPECTED_PR_AUTHOR_USER_NAME: ${{ needs.automation.outputs.application-name }}
COMMENT_BODY: ${{ github.event.comment.body }}
COMMENT_USER_NAME: ${{ github.event.comment.user.login }}
ISSUE_NUMBER: ${{ github.event.issue.number }}
shell: pwsh
run: |
Import-Module .\build\scripts\prepare-release.psm1
UpdateReleaseNotesAndPostNoticeOnPullRequest `
-gitRepository ${env:GITHUB_REPOSITORY} `
-pullRequestNumber ${env:ISSUE_NUMBER} `
-expectedPrAuthorUserName ${env:EXPECTED_PR_AUTHOR_USER_NAME} `
-commentUserName ${env:COMMENT_USER_NAME} `
-commentBody $Env:COMMENT_BODY `
-gitUserName ${env:BOT_USER_NAME} `
-gitUserEmail ${env:BOT_USER_EMAIL}