-
Notifications
You must be signed in to change notification settings - Fork 56
85 lines (72 loc) · 2.89 KB
/
release-prep.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
name: Prep Heat Release
on:
workflow_dispatch:
inputs:
release_version:
description: "The version to release"
required: true
default: "0.0.0"
base_branch:
description: "The base branch to create the release branch from"
required: true
default: "main"
permissions:
contents: write
pull-requests: write
jobs:
release:
# environment: release
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
with:
egress-policy: audit
- uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.base_branch }}
- name: Bump version.py and create PR
env:
PR_BRANCH: pre-release/${{ inputs.release_version }}
VERSION: ${{ inputs.release_version }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Create branch
git checkout -b pre-release/${VERSION}
# Split version number into major, minor, and micro
MAJOR=$(echo $VERSION | cut -d. -f1)
MINOR=$(echo $VERSION | cut -d. -f2)
MICRO=$(echo $VERSION | cut -d. -f3)
# Write on to the version.py file
sed -i "s/major: int = \([0-9]\+\)/major: int = $MAJOR/g" heat/core/version.py
sed -i "s/minor: int = \([0-9]\+\)/minor: int = $MINOR/g" heat/core/version.py
sed -i "s/micro: int = \([0-9]\+\)/micro: int = $MICRO/g" heat/core/version.py
sed -i "s/extension: str = .*/extension: str = None/g" heat/core/version.py
# Git configuration with anonymous user and email
git config --global user.email ""
git config --global user.name "Heat Release Bot"
# Commit the changes
git add heat/core/version.py
git commit -m "Bump version to $VERSION"
# Push the changes
git push --set-upstream origin pre-release/${VERSION}
# Create PR for release
gh pr create \
--base release \
--head ${{ env.PR_BRANCH }} \
--title "Heat ${{ env.VERSION }} - Release" \
--body "Pre-release branch for Heat ${{ env.VERSION }}.
Any release work should be done on this branch, and then merged into the release branch and main, following git-flow.
TODO:
- [x] Update version.py
- [ ] update the Requirements section on README.md if needed
- [ ] Update CITATION.cff if needed
- [ ] Ensure the Changelog is up to date
[1]: https://github.com/peter-evans/create-pull-request" \
--label invalid
# Create PR for main
gh pr create --base main \
--head ${{ env.PR_BRANCH }} \
--title "Heat ${{ env.VERSION }} - Main" \
--body "Copy of latest pre-release PR targeting release." \
--label invalid