Skip to content

Commit

Permalink
Merge pull request #209 from NeuroBench/bumpversion
Browse files Browse the repository at this point in the history
Support for auto-release
  • Loading branch information
jasonlyik authored May 21, 2024
2 parents f43a82f + 5e79d92 commit 4528deb
Show file tree
Hide file tree
Showing 5 changed files with 134 additions and 1 deletion.
27 changes: 27 additions & 0 deletions .bumpversion.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

[tool.bumpversion]
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
serialize = ["{major}.{minor}.{patch}"]
regex = false
current_version = "1.0.3"
ignore_missing_version = false
search = "{current_version}"
replace = "{new_version}"
tag = false
sign_tags = false
tag_name = "{new_version}"
tag_message = "Bump version: {current_version} → {new_version}"
allow_dirty = false
commit = false
message = "Bump version: {current_version} → {new_version}"
commit_args = ""

[[tool.bumpversion.files]]
filename = "pyproject.toml"
search = "version = \"{current_version}\""
replace = "version = \"{new_version}\""

[[tool.bumpversion.files]]
filename = "docs/conf.py"
search = "release = \"{current_version}\""
replace = "release = \"{new_version}\""
36 changes: 36 additions & 0 deletions .github/workflows/publish-distribution.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Publish Distribution to PyPI

on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'

jobs:
build-and-publish-final-dist:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install Poetry
run: |
pip install poetry
- name: Install dependencies
run: |
poetry install --without dev
- name: Build the package
run: |
poetry build
- name: Publish to PyPI
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }}
run: |
poetry publish
70 changes: 70 additions & 0 deletions RELEASE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
Version Release Guidelines
=======================

This document describes the guidelines for releasing new versions of the library. We follow semantic versioning, which means our version numbers have three parts: MAJOR.MINOR.PATCH.

- MAJOR version when you make incompatible API changes
- MINOR version when you add functionality in a backwards-compatible manner
- PATCH version when you make backwards-compatible bug fixes


1. Install the `bump-my-version` package:

```
pip install --upgrade bump-my-version
```
--------------------

2. Create a new branch for the release from dev branch:

```
git checkout -b release/x.y.z
```
--------------------

3. Update the version number using the `bump-my-version` command:

```
bump-my-version bump path
```
or
```
bump-my-version bump minor
```
or
```
bump-my-version bump major
```
--------------------

4. Commit the changes with the following message and push the changes to the release branch:

```
git commit -m "Bump version: {current_version} → {new_version}"
```

```
git push origin release/x.y.z
```

--------------------

5. Create a pull request from the release branch to the dev branch.

6. Once the pull request is approved and merged, create a new pull request from the dev branch to the master branch.

7. Once the pull request is approved and merged, create the tag on the main branch to invoke the package publishing workflow:

```
git tag -a x.y.z -m "Release x.y.z"
```

```
git push origin tag <tag_name>
```
--------------------

8. Once the tag is pushed, the package publishing workflow will be triggered and the package will be published to the PyPI.

9. Once the package is published, create a new release on GitHub with the tag name and the release notes (generate them automatically).

Empty file added docs/_static/.gitkeep
Empty file.
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
project = "NeuroBench"
copyright = "2024, Jason Yik, Noah Pacik-Nelson, Korneel Van Den Berghe"
author = "Jason Yik, Noah Pacik-Nelson, Korneel Van Den Berghe"
release = "v1.0.0"
release = "1.0.3"

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
Expand Down

0 comments on commit 4528deb

Please sign in to comment.