Skip to content

Commit

Permalink
Prepare v0.12.0, conditional bump version (#352)
Browse files Browse the repository at this point in the history
## Overview

Changes:

* Updated the release version string (v0.12.0) and date (today)
* Updated versioning to use SemVer v2.0.0
* Update bump-version action to bump when changes are made to specific
files on the master branch

## Related Issue / Discussion

The version scheme and bumping setup is the same as can be found for
xclim and other Ouranos projects.

## Additional Information

https://semver.org/spec/v2.0.0.html
  • Loading branch information
Zeitsperre authored Mar 25, 2024
2 parents e7e1aea + 485f67e commit 8ed13b1
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 34 deletions.
20 changes: 16 additions & 4 deletions .bumpversion.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
[tool.bumpversion]
current_version = "0.11.4"
current_version = "0.12.0"
commit = true
tag = true
tag = false
tag_name = "v{new_version}"
allow_dirty = false
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)(\\-(?P<release>[a-z]+)(\\.(?P<build>\\d+)))?"
serialize = [
"{major}.{minor}.{patch}",
"{major}.{minor}"
"{major}.{minor}.{patch}-{release}.{build}",
"{major}.{minor}.{patch}"
]

[[tool.bumpversion.files]]
Expand All @@ -27,3 +29,13 @@ replace = "Version=\"{new_version}\""
filename = ".cruft.json"
search = "\"version\": \"{current_version}\","
replace = "\"version\": \"{new_version}\","

[tool.bumpversion.parts.build]
independent = false

[tool.bumpversion.parts.release]
optional_value = "release"
values = [
"dev",
"release"
]
2 changes: 1 addition & 1 deletion .cruft.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"project_repo_name": "finch",
"project_readthedocs_name": "finch",
"project_short_description": "A Web Processing Service for Climate Indicators.",
"version": "0.11.4",
"version": "0.12.0",
"open_source_license": "Apache Software License 2.0",
"http_port": "5000",
"use_pytest": "y",
Expand Down
78 changes: 54 additions & 24 deletions .github/workflows/bump-version-tag.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,49 @@
name: Bump Version and Tag for Release
name: Conditional Bump Version

on:
workflow_dispatch:
inputs:
bumpversion:
description: "Bumpversion"
required: true
default: "patch"
options:
- "patch"
- "minor"
- "major"
tag:
description: "Tag"
required: true
default: true
options:
- "true"
- "false"
push:
branches:
- master
paths-ignore:
- .*
- .github/*/*.md
- .github/*/*.yml
- AUTHORS.rst
- CHANGES.rst
- Dockerfile
- Makefile
- docker-compose.yml
- docs/*/*.ipynb
- docs/*/*.py
- docs/*/*.rst
- docs/Makefile
- docs/_static/*
- environment-docs.yml
- finch/__version__.py
- requirements*.txt
- setup.cfg
- setup.py

permissions:
contents: read

jobs:
bump_patch_version:
name: Bumpversion
runs-on: ubuntu-latest
permissions:
actions: read
contents: write
steps:
- name: Harden Runner
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
with:
disable-sudo: true
egress-policy: block
allowed-endpoints: >
files.pythonhosted.org:443
github.com:443
pypi.org:443
- uses: actions/checkout@v4
with:
persist-credentials: false
Expand All @@ -37,24 +58,33 @@ jobs:
run: |
CURRENT_VERSION="$(grep -E '__version__' finch/__version__.py | cut -d ' ' -f3)"
echo "current_version=${CURRENT_VERSION}"
echo "CURRENT_VERSION=${CURRENT_VERSION}" >> $GITHUB_ENV
- name: Bump Version
if: ${{ github.event.inputs.tag == 'false' }}
run: |
pip install bump-my-version
echo "running `bump-my-version bump --no-tag ${{ github.event.inputs.bumpversion }}`"
NEW_VERSION="$(grep -E '__version__' finch/__version__.py | cut -d ' ' -f3)"
echo "new_version=${NEW_VERSION}"
- name: Bump Version with Tagging
if: ${{ github.event.inputs.tag == 'true' }}
- name: Install bump-my-version
run: |
pip install bump-my-version
echo "running `bump-my-version bump ${{ github.event.inputs.bumpversion }}`"
NEW_VERSION="$(grep -E '__version__' finch/__version__.py | cut -d ' ' -f3)"
python -m pip install bump-my-version>=0.18.3
- name: Conditional Bump
id: bump
run: |
if [[ ${{ env.CURRENT_VERSION }} =~ -dev(\.\d+)? ]]; then
echo "Development version (ends in 'dev(\.\d+)?'), bumping 'build' version"
bump-my-version bump build
else
echo "Version is stable, bumping 'patch' version"
bump-my-version bump patch
fi
NEW_VERSION="$(grep -E '__version__' finch/__version__.py | cut -d ' ' -f3)"
echo "new_version=${NEW_VERSION}"
echo "NEW_VERSION=${NEW_VERSION}" >> $GITHUB_ENV
- name: Push Changes
uses: ad-m/github-push-action@master
with:
force: false
github_token: ${{ secrets.BUMPVERSION_TOKEN }}
branch: ${{ github.ref }}
tags: true
4 changes: 3 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
Changes
*******

0.11.5 (unreleased)
0.12.0 (2024-03-25)
===================
* Renamed the installed package from `finch` to `birdhouse-finch`.
* First release of the `birdhouse-finch` package on PyPI.
* Versioning now adheres to SemVer v2.0.0.
* Added a Makefile recipe to the repository to evaluate notebooks while ignoring the output cells.
* Cleaned up documentation to facilitate easier navigation.
* Slightly reorganized the documentation for easier navigation.
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM condaforge/mambaforge
ARG DEBIAN_FRONTEND=noninteractive
ENV PIP_ROOT_USER_ACTION=ignore
LABEL org.opencontainers.image.authors="https://github.com/bird-house/finch"
LABEL Description="Finch WPS" Vendor="Birdhouse" Version="0.11.4"
LABEL Description="Finch WPS" Vendor="Birdhouse" Version="0.12.0"

# Switch to /code directory
WORKDIR /code
Expand Down
4 changes: 2 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@
# the built documents.
#
# The short X.Y version.
version = "0.11.4"
version = "0.12.0".split("-")[0]
# The full version, including alpha/beta/rc tags.
release = "0.11.4"
release = "0.12.0"

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
2 changes: 1 addition & 1 deletion finch/__version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@

__author__ = """David Huard"""
__email__ = "huard.david@ouranos.ca"
__version__ = "0.11.4"
__version__ = "0.12.0"

0 comments on commit 8ed13b1

Please sign in to comment.