-
Notifications
You must be signed in to change notification settings - Fork 262
80 lines (68 loc) · 3.03 KB
/
create-release-pr.yml
File metadata and controls
80 lines (68 loc) · 3.03 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
name: Create Release PR
on:
workflow_dispatch:
schedule:
# Midnight on the 1st of every 2nd month
- cron: 0 0 1 */2 *
jobs:
create-release-pr:
if: github.repository == 'hail-is/hail'
runs-on: ubuntu-latest
permissions:
contents: 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}" >> "${GITHUB_OUTPUT}"
echo "new=${prefix}.${n}" >> "${GITHUB_OUTPUT}"
echo "next=${prefix}.$((n + 1))" >> "${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: |
cat << 'EOF' | gh pr create --base=main --head=$(git branch --show-current) --draft --fill -F -
# 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 Next Milestone ${{ steps.version.outputs.next }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh api -X POST "/repos/${GITHUB_REPOSITORY}/milestones" \
-f "title=${{ steps.version.outputs.next }}" \
-f "due_on=$(date --iso-8601=seconds --utc --date='+2 months +1 week 00:00')"