-
Notifications
You must be signed in to change notification settings - Fork 1
135 lines (113 loc) · 3.93 KB
/
release-checklist.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
name: '[ci] release-checklist'
on:
push:
tags: ["**"]
env:
RELEASE_CHECKLIST_TAG: release checklist
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
ACTOR: ${{ github.actor }}
TAG_NAME: ${{ github.ref_name }}
jobs:
# workflow and siibra-python will likely break with tag including /
# workflow: see sed
# siibra-python: see reftag escaping
sanitiy-check:
runs-on: ubuntu-latest
steps:
- name: "checks tag does not contain slash"
run: |
echo ${{ env.TAG_NAME }} | grep -Fq "/" && exit 1 || exit 0
get-all-opened:
runs-on: ubuntu-latest
needs:
- sanitiy-check
if: success()
outputs:
OPEN_RELEASE_ISSUES: ${{ steps.get-all-issues.outputs.ALL_ISSUES }}
steps:
- name: 'Getting all opened issue matching ${{ env.RELEASE_CHECKLIST_TAG }} in ${{ env.REPO }}'
id: 'get-all-issues'
run: |
issue=$(gh issue list \
--repo ${{ env.REPO }} \
--label '${{ env.RELEASE_CHECKLIST_TAG }}' \
--json 'id,body,number,url,title')
echo Found:
echo $issue
echo "ALL_ISSUES=$issue" >> $GITHUB_OUTPUT
update-existing-body:
runs-on: ubuntu-latest
needs:
- get-all-opened
steps:
- run: |
OPEN_RELEASE_ISSUES='${{ needs.get-all-opened.outputs.OPEN_RELEASE_ISSUES }}'
echo Found open issues: $OPEN_RELEASE_ISSUES
for issue in $(echo "$OPEN_RELEASE_ISSUES" | jq -c '.[]' | base64 -w 0)
do
issue=$(echo $issue | base64 -d)
url=$(echo $issue | jq -r '.url')
echo url=$url
new_issue_body=$(echo $issue | jq -r '.body' | sed '1s/master/${{ env.TAG_NAME }}/')
echo new_issue_body=$new_issue_body
new_title=$(echo $issue | jq -r '.title' | sed 's/v???/${{ env.TAG_NAME }}/')
echo new_title=$new_title
echo update issue $url
echo new_title=$new_title
echo new_issue_body: $new_issue_body
echo -e $new_issue_body | gh issue edit "$url" -F -
done
add-comment-existing:
runs-on: ubuntu-latest
needs:
- get-all-opened
steps:
- run: |
OPEN_RELEASE_ISSUES='${{ needs.get-all-opened.outputs.OPEN_RELEASE_ISSUES }}'
echo Found open issues: $OPEN_RELEASE_ISSUES
for issue in $(echo "$OPEN_RELEASE_ISSUES" | jq -c '.[]' | base64 -w 0)
do
issue=$(echo $issue | base64 -d)
url=$(echo $issue | jq -r '.url')
echo $issue | jq -r '.body' | grep -Fq "<person name>"
validated=$(echo $?)
new_comment="Thank you ${{ env.ACTOR }} for the release."
if [[ "$validated" != "0" ]]
then
new_comment="$new_comment\\n\\nCan you double check you have validated the release?"
fi
echo update issue $url
echo -e new_comment: \\n\\n bar $new_comment
echo -e $new_comment | gh issue comment $url -F -
done
close-existing:
runs-on: ubuntu-latest
needs:
- get-all-opened
steps:
- name: "Add comment to issue"
run: |
OPEN_RELEASE_ISSUES='${{ needs.get-all-opened.outputs.OPEN_RELEASE_ISSUES }}'
echo Found open issues: $OPEN_RELEASE_ISSUES
for issue in $(echo "$OPEN_RELEASE_ISSUES" | jq -c '.[]' | base64 -w 0)
do
issue=$(echo $issue | base64 -d)
id=$(echo $issue | jq -r '.id')
url=$(echo $issue | jq -r '.url')
gh issue close $url -r completed
done
open-new:
runs-on: ubuntu-latest
needs:
- get-all-opened
steps:
- uses: actions/checkout@v4
- run: |
new_issue=$(sed '1s/LATEST_TAG_PLACEHOLDER/${{ env.TAG_NAME }}/' release_checklist.md)
echo -e new_issue: $new_issue
echo -e $new_issue | gh issue create \
-R ${{ env.REPO }} \
-l '${{ env.RELEASE_CHECKLIST_TAG }}' \
-t '[release checklist] v???' \
-F -