-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automate release preparation process #1710
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
name: "Release prep (Admin only)" | ||
description: Trigger release preparation workflow | ||
title: "x.y.z" | ||
labels: ["release-prep"] | ||
|
||
body: | ||
- type: markdown | ||
attributes: | ||
value: | | ||
Replace the **title** with the version number of the release you are preparing (stick to the format `x.y.z`) and Submit the issue. | ||
|
||
You can leave the body of the issue empty. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
name: Prep Heat Release | ||
|
||
on: | ||
issues: | ||
types: [opened] | ||
env: | ||
working_branch: workflows/release-prep | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Harden Runner | ||
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 | ||
with: | ||
egress-policy: audit | ||
|
||
- uses: actions/checkout@v3 | ||
- name: Extract Version Information | ||
id: extract-version | ||
if: contains(github.event.issue.labels.*.name, 'release-prep') | ||
run: | | ||
issue_title="${{ github.event.issue.title }}" | ||
major=$(echo "$issue_title" | cut -d '.' -f 1) | ||
minor=$(echo "$issue_title" | cut -d '.' -f 2) | ||
micro=$(echo "$issue_title" | cut -d '.' -f 3) | ||
echo "major=$major" >> $GITHUB_OUTPUT | ||
echo "minor=$minor" >> $GITHUB_OUTPUT | ||
echo "micro=$micro" >> $GITHUB_OUTPUT | ||
- name: Delete Existing Version Update Branch | ||
run: git push --delete origin ${{ env.working_branch }} || true | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When is this branch created, or where does it come from? |
||
- name: Create Release Branch | ||
if: steps.extract-version.outputs.micro == 0 | ||
run: | | ||
git checkout -b release/${{ steps.extract-version.outputs.major }}.${{ steps.extract-version.outputs.minor }}.x | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would add an extra |
||
git push origin release/${{ steps.extract-version.outputs.major }}.${{ steps.extract-version.outputs.minor }}.x | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In keeping with git-flow style branches, I would call this "pre-release/x.y.z". Based on this link, "main" is would be "release" in our case, "develop" is "main", and we could name "release/x.y.z" as "pre-release/x.y.z". |
||
- name: Bump Version | ||
if: always() | ||
run: | | ||
git fetch origin | ||
git checkout release/${{ steps.extract-version.outputs.major }}.${{ steps.extract-version.outputs.minor }}.x | ||
git checkout -b ${{ env.working_branch }} | ||
git push origin ${{ env.working_branch }} | ||
sed -i "s/major: int = \([0-9]\+\)/major: int = ${{ steps.extract-version.outputs.major }}/g" heat/core/version.py | ||
sed -i "s/minor: int = \([0-9]\+\)/minor: int = ${{ steps.extract-version.outputs.minor }}/g" heat/core/version.py | ||
sed -i "s/micro: int = \([0-9]\+\)/micro: int = ${{ steps.extract-version.outputs.micro }}/g" heat/core/version.py | ||
sed -i "s/extension: str = .*/extension: str = None/g" heat/core/version.py | ||
- name: Create PR from branch | ||
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # v7.0.5 | ||
with: | ||
base: release/${{ steps.extract-version.outputs.major }}.${{ steps.extract-version.outputs.minor }}.x | ||
branch: ${{ env.working_branch }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The base branch should be "release", and the branch should be our newly created branch, right? "pre-release/x.y.z" |
||
delete-branch: true | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
commit-message: Bump version to ${{ steps.extract-version.outputs.major }}.${{ steps.extract-version.outputs.minor }}.${{ steps.extract-version.outputs.micro }} | ||
title: Prepare for Heat release ${{ steps.extract-version.outputs.major }}.${{ steps.extract-version.outputs.minor }}.${{ steps.extract-version.outputs.micro }} | ||
body: | | ||
Preparation steps before releasing a new version | ||
Issue/s resolved: #${{ github.event.issue.number }} | ||
TODO: | ||
- [x] Update version.py | ||
- [ ] update the Requirements section on README.md if needed | ||
- [ ] Update CITATION.cff if needed | ||
Auto-generated by [create-pull-request][1] | ||
[1]: https://github.com/peter-evans/create-pull-request | ||
labels: chore | ||
draft: false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think using a
workflow_dispatch
trigger might be a better option.More on this: https://docs.github.com/en/actions/managing-workflow-runs-and-deployments/managing-workflow-runs/manually-running-a-workflow