Skip to content

Commit

Permalink
Merge pull request #1780 from JuanPedroGHM/main
Browse files Browse the repository at this point in the history
Renaming ```release``` branch to ```stable```
  • Loading branch information
JuanPedroGHM authored Feb 12, 2025
2 parents c907f75 + 3c6ea78 commit 522f667
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 136 deletions.
3 changes: 2 additions & 1 deletion .github/rd-release-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,12 @@ autolabeler:
- label: 'docker'
files:
- 'docker/**/*'
- label: 'backport release'
- label: 'backport stable'
title:
- '/bug/i'
- '/resolve/i'
- '/fix/i'
- '/\[pre\-commit\.ci\]/i'
branch:
- '/bug/i'
- '/fix/i'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/CIBase.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches:
- 'main'
- 'release/**'
- 'stable'

permissions:
contents: read
Expand Down
55 changes: 0 additions & 55 deletions .github/workflows/changelog-updater.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Release Drafter

on:
pull_request_target:
pull_request:
types: [opened, reopened, synchronize]
jobs:
update_release_draft:
Expand All @@ -19,6 +19,6 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
commitish: 'release'
commitish: 'stable'
name: ${{ github.ref_name }} - Draft release
config-name: rd-release-config.yml
41 changes: 31 additions & 10 deletions .github/workflows/release-prep.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ on:
description: "The base branch to create the release branch from"
required: true
default: "main"
title:
description: "Release title"
required: False
default: "Heat"

permissions:
contents: write
Expand All @@ -29,6 +33,14 @@ jobs:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.base_branch }}
- uses: release-drafter/release-drafter@v6 # v6.0.0
id: release_drafter
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
commitish: 'stable'
name: ${{ github.event.inputs.title }}
config-name: rd-release-config.yml
- name: Bump version.py and create PR
env:
PR_BRANCH: pre-release/${{ inputs.release_version }}
Expand All @@ -49,37 +61,46 @@ jobs:
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
{ echo -e "# v${MAJOR}.${MINOR}.${MICRO} - ${{github.event.inputs.title}}\n${{ steps.release_drafter.outputs.body}}\n"; cat CHANGELOG.md; } > tmp.md
mv tmp.md CHANGELOG.md
# 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 add heat/core/version.py CHANGELOG.md
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 \
--base stable \
--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.
Any release work should be done on this branch, and then merged into `stable` and `main`, following git-flow guidelines.
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
- [ ] Ensure Citation file `CITATION.cff` is up to date.
- [ ] Ensure the Changelog is up to date.
[1]: https://github.com/peter-evans/create-pull-request" \
--label invalid
DO NOT DELETE BRANCH AFTER MERGING!" \
--label "pre-release"
# 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
--draft \
--body "Copy of latest pre-release PR targeting release.
DO NOT CHANGE ANYTHING UNTIL "Heat ${{ env.VERSION }} - Release" HAS BEEN MERGED.
TODO:
- [ ] Make sure version.py is updated to reflect the dev version.
- [ ] Ensure Citation file is up to date.
- [ ] Ensure the Changelog is up to date." \
--label "pre-release"
95 changes: 28 additions & 67 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,51 +18,33 @@ In the following, we assume we are about to release Heat v1.5.0.
- You need [PyPi](https://pypi.org/), [Test.PyPi](https://test.pypi.org/) account
- All intended PRs are merged, all tests have passed, and the `main` branch is ready for release.

1. We will release all new features in the development branch `main`. Branch off `main` to create a new release branch, e.g.:
**Create Pre-release Branch**

```bash
git checkout main
git pull
git checkout -b release/1.5.x
```
1. Got to [this GH Action](https://github.com/helmholtz-analytics/heat/actions/workflows/release-prep.yml) and start a new manual workflow.

2. Create a new branch off `release/1.5.x` and update the version number in `heat/core/version.py`:
1. `Use workflow from` should always be `main`.
2. Change the version number to the next release (1.5.0) in this case.
3. Because this is a major or minor release, the base branch should be `main`.
4. Change the title, if you want to give the release a special name.
5. Run the workflow.

```bash
git checkout release/1.5.x
git pull
git checkout -b workflows/version-update
```
When the workflow is done, you should see two new pull requests. One targeting `main`, the other one targeting `stable`. Both should be created for the same branch, `pre-release/x.y.z`. The new branch should include changes with the new version number on `version.py`, and an up-to-date `CHANGELOG.md`. For now, ignore the PR targeting main. That PR should only be merged after the release has been merged to `stable`.



Update `heat/core/version.py` like this:

```python
"""This module contains Heat's version information."""

major: int = 1
"""Indicates Heat's main version."""
minor: int = 4 # <-- update to 5
"""Indicates feature extension."""
micro: int = 2 # <-- update to 0
"""Indicates revisions for bugfixes."""
extension: str = "dev" # <-- set to None
"""Indicates special builds, e.g. for specific hardware."""
```

3. Commit and push new `version.py` in `workflows/version-update`.
2. Ensure that the changes to `version.py` and `CHANGELOG.md` are correct, if not, fix them.

4. If necessary, also update the Requirements section on README.md to reflect the latest version of the dependencies.

5. Update `CITATION.cff` if needed, i.e. add names of non-core contributors (they are included in the Release notes draft you just created). Push to `workflows/version-update`.

6. Create a pull request from `workflows/version-update` to `release/1.5.x`

6. Once the changes are done, merge the pull request.
- ONLY MERGE THE PR FOR `stable`
- DO NOT DELETE THE BRANCH AFTERWARDS.
- Remember to get a reviewers approval.
- Wait for the tests to finish.
- Squash and merge.

Go to the main repo page, and then to releases (right panel). There should be a draft release with the changes made by the latest release.

7. Draft release notes:

- Go to the GitHub repo's [Releases](https://github.com/helmholtz-analytics/heat/releases) page.
Expand All @@ -71,7 +53,8 @@ extension: str = "dev" # <-- set to None
- Edit release notes as needed (see older releases)
- Click on Save **but do not publish yet**

8. Build wheel in your local `heat/` directory, make sure you are on branch `release/1.5.x`.
8. On your local machine, fetch all the changes from origin, checkout the `stable` branch.
9. Build wheel in your local `heat/` directory.

```bash
rm -f dist/*
Expand All @@ -80,37 +63,26 @@ extension: str = "dev" # <-- set to None

You might have to install the `build` package first (i.e. with `conda install -c conda-forge build` or `pip install build`)

9. Upload to Test PyPI and verify things look right. You need to install `twine` first.
10. Upload to Test PyPI and verify things look right. You need to install `twine` first.

```bash
twine upload -r testpypi dist/*
```

`twine` will prompt for your username and password.

10. When everything works, upload to PyPI:
11. When everything works, upload to PyPI:

```bash
twine upload dist/*
```

11. Go back to the Release Notes draft and publish them. The new release is out!
12. Go back to the Release Notes draft and publish them. The new release is out!

- Make sure the CHANGELOG.md got updated, if not, call @JuanPedroGHM.
- Check our [Zenodo page](https://zenodo.org/doi/10.5281/zenodo.2531472) to make sure a DOI was created for the release.

12. On branch `main`, we want to modify the version so that `minor` is increased by 1, and `extension` is "dev". In this example we want the version on `main` to be:`1.6.0-dev`. We need to create a new branch from `main`:

```bash
git checkout main
git pull
git checkout -b workflows/update-version-main
git branch
```

On branch `workflows/update-version-main`, modify `version.py` so that `minor` is increased by 1, and `extension` is `"dev"`. Commit and push the changes.

13. Create a PR with `main` as the base branch.
13. On branch `main`, we want to modify the version so that `minor` is increased by 1, and `extension` is "dev". We also want to merge any changes to the changelog, and overall make sure it is up to date with the latest release changes. That is what the second PR is for. In this example we want the version on `main` to be:`1.6.0-dev`. We go to the left over PR, and change the version number accordingly. Make sure to also fix any merge conflicts.

14. Get approval and merge. You're done! Except if you're a conda-forge maintainer, then see [conda-forge build](#conda-forge-build).

Expand All @@ -119,28 +91,17 @@ extension: str = "dev" # <-- set to None

(e.g. 1.5.0 --> 1.5.1)

1. Check that all intended branches have been merged to the release branch you want to upgrade, in this example `release/1.5.x`. Create a new branch off `release/1.5.x`, e.g.:

```bash
git checkout release/1.5.x
git pull
git checkout -b workflows/version-update
```
1. Check that all intended branches have been merged to the `stable` branch.

2. Update `heat/core/version.py` like this:
2. Got to [this GH Action](https://github.com/helmholtz-analytics/heat/actions/workflows/release-prep.yml) and start a new manual workflow.

```python
"""This module contains Heat's version information."""
1. Use workflow from should always be main.
2. Change the version number to the next release (1.5.1) in this case.
3. Because this is a patch release, the base branch should be `stable`.
4. Change the title, if you want to give the release a special name.
5. Run the workflow.

major: int = 1
"""Indicates Heat's main version."""
minor: int = 5
"""Indicates feature extension."""
micro: int = 0 # <-- update to 1
"""Indicates revisions for bugfixes."""
extension: str = None
"""Indicates special builds, e.g. for specific hardware."""
```
When the workflow is done, you should see two new pull requests. One targeting `main`, the other one targeting `stable`. Both should be created for the same branch, `pre-release/x.y.z`. The new branch should include changes with the new version number on `version.py`, and an update `CHANGELOG.md`. For now, ignore the PR targeting main. That PR should only be merged after the release has been merged to `stable`.

3. Follow steps 3-14 from the [Major or minor release section](#major-or-minor-release).

Expand Down

0 comments on commit 522f667

Please sign in to comment.