Repository navigation
99 lines (83 loc) · 3.75 KB
/
Copy pathcreate-patch-release.yml
File metadata and controls
99 lines (83 loc) · 3.75 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
name: Create Patch Release
on:
workflow_dispatch:
schedule:
# At 00:00 on the 20th of every 3rd month from February through November.
- cron: 0 0 20 2/3 *
jobs:
create-release-pr:
if: github.repository == 'hail-is/hail'
runs-on: ubuntu-latest
permissions:
contents: write
issues: write
pull-requests: write
defaults:
run:
shell: bash -ex {0}
steps:
- uses: actions/checkout@v4
- name: Increment Patch Version
id: version
run: |
prefix=$(grep -Po '(?<=HAIL_MAJOR_MINOR_VERSION := )(\d+\.\d+)' hail/Makefile)
patch=$(grep -Po '(?<=HAIL_PATCH_VERSION := )(\d+)' hail/Makefile)
n=$((patch + 1))
sed -Ei 's|(HAIL_PATCH_VERSION := )[[:digit:]]+|\1'"${n}"'|' hail/Makefile
sed -Ei 's|(hailPatchVersion = ")[[:digit:]]+|\1'"${n}"'|' hail/build.mill
{ echo "old=${prefix}.${patch}"; echo "new=${prefix}.${n}"; echo "fut=${prefix}.$((n + 3))"; } >> "${GITHUB_OUTPUT}"
- name: Generate Changelog Entries
working-directory: hail
run: |
git fetch --unshallow --filter=tree:0 --no-tags origin tag ${{ steps.version.outputs.old }}
bash scripts/update-changelog
# identity from https://api.github.com/users/github-actions%5Bbot%5D
- name: Commit and Push
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
git checkout -B "release/${{ steps.version.outputs.new }}"
git commit -m "[release] ${{ steps.version.outputs.new }}" \
hail/python/hail/docs/change_log.md \
hail/python/hailtop/batch/docs/change_log.rst \
hail/build.mill \
hail/Makefile
git push origin "$(git branch --show-current)" --force-with-lease
- name: Create Pull Request
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
issue_number=$(gh issue list \
--search '"[release] ${{ steps.version.outputs.new }}" in:title' \
--state open \
--limit 1 \
--json number \
--jq '.[0].number')
if [ -z "$issue_number" ] || [ "$issue_number" = "null" ]; then
echo "Error: No matching issue found for version ${{ steps.version.outputs.new }}"
exit 1
fi
cat << EOF | gh pr create --base=main --head="$(git branch --show-current)" --draft --fill -F -
Closes #${issue_number}
# Release Checklist (delete before merge)
- [ ] Verify new PATCH version is correct
- [ ] Organise / format / expand / delete new entries from
- [ ] hail/python/hail/docs/change_log.md
- [ ] hail/python/hailtop/batch/docs/change_log.rst
# Security Assessment
This change has low security impact as:
- there are no functional changes herein
- all changes since the last release have an approved security impact assessment.
EOF
- name: Create Future Milestone ${{ steps.version.outputs.fut }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
milestone_number=$(gh api -X POST '/repos/${{ github.repository }}/milestones' \
-f 'title=${{ steps.version.outputs.fut }}' \
-f "due_on=$(date --utc --iso-8601=seconds --date="$(date +%Y-%m-01) +9 months 00:00")" \
--jq '.number')
gh api -X POST '/repos/${{ github.repository }}/issues' \
-f 'title=[release] ${{ steps.version.outputs.fut }}' \
-f "milestone=${milestone_number}" \
-f 'type=Task'