-
Notifications
You must be signed in to change notification settings - Fork 769
171 lines (138 loc) · 5.42 KB
/
prepare-release.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
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
jobs:
automation:
uses: ./.github/workflows/automation.yml
secrets: inherit
prepare-release-pr:
runs-on: ubuntu-latest
needs: automation
if: github.event_name == 'workflow_dispatch' && needs.automation.outputs.enabled
env:
GH_TOKEN: ${{ secrets[needs.automation.outputs.token-secret-name] }}
steps:
- name: check out code
uses: actions/checkout@v4
with:
token: ${{ secrets[needs.automation.outputs.token-secret-name] }}
- name: Create GitHub Pull Request to prepare release
shell: pwsh
run: |
Import-Module .\build\scripts\prepare-release.psm1
CreatePullRequestToUpdateChangelogsAndPublicApis `
-gitRepository '${{ github.repository }}' `
-minVerTagPrefix '${{ inputs.tag-prefix }}' `
-version '${{ inputs.version }}' `
-requestedByUserName '${{ github.event.sender.login }}' `
-targetBranch '${{ github.ref_name }}' `
-gitUserName '${{ needs.automation.outputs.username }}' `
-gitUserEmail '${{ needs.automation.outputs.email }}'
lock-pr-and-post-notice-to-create-release-tag:
runs-on: ubuntu-latest
needs: automation
if: |
github.event_name == 'pull_request'
&& github.event.action == 'closed'
&& github.event.pull_request.user.login == needs.automation.outputs.username
&& github.event.pull_request.merged == true
&& startsWith(github.event.pull_request.title, '[release] Prepare release ')
&& needs.automation.outputs.enabled
env:
GH_TOKEN: ${{ secrets[needs.automation.outputs.token-secret-name] }}
steps:
- name: check out code
uses: actions/checkout@v4
with:
token: ${{ secrets[needs.automation.outputs.token-secret-name] }}
- name: Lock GitHub Pull Request to prepare release
shell: pwsh
run: |
Import-Module .\build\scripts\prepare-release.psm1
LockPullRequestAndPostNoticeToCreateReleaseTag `
-gitRepository '${{ github.repository }}' `
-pullRequestNumber '${{ github.event.pull_request.number }}' `
-botUserName '${{ needs.automation.outputs.username }}'
create-release-tag-pr-post-notice:
runs-on: ubuntu-latest
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.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
env:
GH_TOKEN: ${{ secrets[needs.automation.outputs.token-secret-name] }}
steps:
- name: check out code
uses: actions/checkout@v4
with:
# Note: By default GitHub only fetches 1 commit which fails the git tag operation below
fetch-depth: 0
token: ${{ secrets[needs.automation.outputs.token-secret-name] }}
- name: Create release tag
id: create-tag
shell: pwsh
run: |
Import-Module .\build\scripts\prepare-release.psm1
CreateReleaseTagAndPostNoticeOnPullRequest `
-gitRepository '${{ github.repository }}' `
-pullRequestNumber '${{ github.event.issue.number }}' `
-botUserName '${{ needs.automation.outputs.username }}' `
-gitUserName '${{ needs.automation.outputs.username }}' `
-gitUserEmail '${{ needs.automation.outputs.email }}'
update-changelog-release-dates-on-prepare-pr-post-notice:
runs-on: ubuntu-latest
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.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
env:
GH_TOKEN: ${{ secrets[needs.automation.outputs.token-secret-name] }}
steps:
- name: check out code
uses: actions/checkout@v4
with:
# Note: By default GitHub only fetches 1 commit which fails the git tag operation below
fetch-depth: 0
token: ${{ secrets[needs.automation.outputs.token-secret-name] }}
- name: Update release date
id: create-tag
shell: pwsh
run: |
Import-Module .\build\scripts\prepare-release.psm1
UpdateChangelogReleaseDatesAndPostNoticeOnPullRequest `
-gitRepository '${{ github.repository }}' `
-pullRequestNumber '${{ github.event.issue.number }}' `
-botUserName '${{ needs.automation.outputs.username }}' `
-commentUserName '${{ github.event.comment.user.login }}' `
-gitUserName '${{ needs.automation.outputs.username }}' `
-gitUserEmail '${{ needs.automation.outputs.email }}'