Skip to content

Commit 8ed13b1

Browse files
authored
Prepare v0.12.0, conditional bump version (#352)
## 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
2 parents e7e1aea + 485f67e commit 8ed13b1

File tree

7 files changed

+78
-34
lines changed

7 files changed

+78
-34
lines changed

.bumpversion.toml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
[tool.bumpversion]
2-
current_version = "0.11.4"
2+
current_version = "0.12.0"
33
commit = true
4-
tag = true
4+
tag = false
55
tag_name = "v{new_version}"
6+
allow_dirty = false
7+
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)(\\-(?P<release>[a-z]+)(\\.(?P<build>\\d+)))?"
68
serialize = [
7-
"{major}.{minor}.{patch}",
8-
"{major}.{minor}"
9+
"{major}.{minor}.{patch}-{release}.{build}",
10+
"{major}.{minor}.{patch}"
911
]
1012

1113
[[tool.bumpversion.files]]
@@ -27,3 +29,13 @@ replace = "Version=\"{new_version}\""
2729
filename = ".cruft.json"
2830
search = "\"version\": \"{current_version}\","
2931
replace = "\"version\": \"{new_version}\","
32+
33+
[tool.bumpversion.parts.build]
34+
independent = false
35+
36+
[tool.bumpversion.parts.release]
37+
optional_value = "release"
38+
values = [
39+
"dev",
40+
"release"
41+
]

.cruft.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"project_repo_name": "finch",
2323
"project_readthedocs_name": "finch",
2424
"project_short_description": "A Web Processing Service for Climate Indicators.",
25-
"version": "0.11.4",
25+
"version": "0.12.0",
2626
"open_source_license": "Apache Software License 2.0",
2727
"http_port": "5000",
2828
"use_pytest": "y",

.github/workflows/bump-version-tag.yml

Lines changed: 54 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,49 @@
1-
name: Bump Version and Tag for Release
1+
name: Conditional Bump Version
22

33
on:
4-
workflow_dispatch:
5-
inputs:
6-
bumpversion:
7-
description: "Bumpversion"
8-
required: true
9-
default: "patch"
10-
options:
11-
- "patch"
12-
- "minor"
13-
- "major"
14-
tag:
15-
description: "Tag"
16-
required: true
17-
default: true
18-
options:
19-
- "true"
20-
- "false"
4+
push:
5+
branches:
6+
- master
7+
paths-ignore:
8+
- .*
9+
- .github/*/*.md
10+
- .github/*/*.yml
11+
- AUTHORS.rst
12+
- CHANGES.rst
13+
- Dockerfile
14+
- Makefile
15+
- docker-compose.yml
16+
- docs/*/*.ipynb
17+
- docs/*/*.py
18+
- docs/*/*.rst
19+
- docs/Makefile
20+
- docs/_static/*
21+
- environment-docs.yml
22+
- finch/__version__.py
23+
- requirements*.txt
24+
- setup.cfg
25+
- setup.py
26+
27+
permissions:
28+
contents: read
29+
2130
jobs:
2231
bump_patch_version:
2332
name: Bumpversion
2433
runs-on: ubuntu-latest
34+
permissions:
35+
actions: read
36+
contents: write
2537
steps:
38+
- name: Harden Runner
39+
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
40+
with:
41+
disable-sudo: true
42+
egress-policy: block
43+
allowed-endpoints: >
44+
files.pythonhosted.org:443
45+
github.com:443
46+
pypi.org:443
2647
- uses: actions/checkout@v4
2748
with:
2849
persist-credentials: false
@@ -37,24 +58,33 @@ jobs:
3758
run: |
3859
CURRENT_VERSION="$(grep -E '__version__' finch/__version__.py | cut -d ' ' -f3)"
3960
echo "current_version=${CURRENT_VERSION}"
61+
echo "CURRENT_VERSION=${CURRENT_VERSION}" >> $GITHUB_ENV
4062
- name: Bump Version
4163
if: ${{ github.event.inputs.tag == 'false' }}
4264
run: |
4365
pip install bump-my-version
4466
echo "running `bump-my-version bump --no-tag ${{ github.event.inputs.bumpversion }}`"
4567
NEW_VERSION="$(grep -E '__version__' finch/__version__.py | cut -d ' ' -f3)"
4668
echo "new_version=${NEW_VERSION}"
47-
- name: Bump Version with Tagging
48-
if: ${{ github.event.inputs.tag == 'true' }}
69+
- name: Install bump-my-version
4970
run: |
50-
pip install bump-my-version
51-
echo "running `bump-my-version bump ${{ github.event.inputs.bumpversion }}`"
52-
NEW_VERSION="$(grep -E '__version__' finch/__version__.py | cut -d ' ' -f3)"
71+
python -m pip install bump-my-version>=0.18.3
72+
- name: Conditional Bump
73+
id: bump
74+
run: |
75+
if [[ ${{ env.CURRENT_VERSION }} =~ -dev(\.\d+)? ]]; then
76+
echo "Development version (ends in 'dev(\.\d+)?'), bumping 'build' version"
77+
bump-my-version bump build
78+
else
79+
echo "Version is stable, bumping 'patch' version"
80+
bump-my-version bump patch
81+
fi
82+
NEW_VERSION="$(grep -E '__version__' finch/__version__.py | cut -d ' ' -f3)"
5383
echo "new_version=${NEW_VERSION}"
84+
echo "NEW_VERSION=${NEW_VERSION}" >> $GITHUB_ENV
5485
- name: Push Changes
5586
uses: ad-m/github-push-action@master
5687
with:
5788
force: false
5889
github_token: ${{ secrets.BUMPVERSION_TOKEN }}
5990
branch: ${{ github.ref }}
60-
tags: true

CHANGES.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
Changes
22
*******
33

4-
0.11.5 (unreleased)
4+
0.12.0 (2024-03-25)
55
===================
66
* Renamed the installed package from `finch` to `birdhouse-finch`.
7+
* First release of the `birdhouse-finch` package on PyPI.
8+
* Versioning now adheres to SemVer v2.0.0.
79
* Added a Makefile recipe to the repository to evaluate notebooks while ignoring the output cells.
810
* Cleaned up documentation to facilitate easier navigation.
911
* Slightly reorganized the documentation for easier navigation.

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ FROM condaforge/mambaforge
33
ARG DEBIAN_FRONTEND=noninteractive
44
ENV PIP_ROOT_USER_ACTION=ignore
55
LABEL org.opencontainers.image.authors="https://github.com/bird-house/finch"
6-
LABEL Description="Finch WPS" Vendor="Birdhouse" Version="0.11.4"
6+
LABEL Description="Finch WPS" Vendor="Birdhouse" Version="0.12.0"
77

88
# Switch to /code directory
99
WORKDIR /code

docs/source/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,9 @@
132132
# the built documents.
133133
#
134134
# The short X.Y version.
135-
version = "0.11.4"
135+
version = "0.12.0".split("-")[0]
136136
# The full version, including alpha/beta/rc tags.
137-
release = "0.11.4"
137+
release = "0.12.0"
138138

139139
# The language for content autogenerated by Sphinx. Refer to documentation
140140
# for a list of supported languages.

finch/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55

66
__author__ = """David Huard"""
77
__email__ = "[email protected]"
8-
__version__ = "0.11.4"
8+
__version__ = "0.12.0"

0 commit comments

Comments
 (0)