Skip to content

Commit 156c21e

Browse files
committed
fix(ci): use bump-my-version and fix release CI
1 parent baaf548 commit 156c21e

File tree

4 files changed

+40
-14
lines changed

4 files changed

+40
-14
lines changed

.github/workflows/create-release.yml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
workflow_dispatch:
55
inputs:
66
versionName:
7-
description: 'Semantic Version Number (i.e., 5.5.0 or patch, minor, major, prepatch, preminor, premajor, prerelease)'
7+
description: 'Semantic Version Number (i.e., 5.5.0 or patch, minor, major)'
88
required: true
99
default: patch
1010

@@ -28,9 +28,20 @@ jobs:
2828
- name: Change version number
2929
id: version
3030
run: |
31-
python -m pip install bump2version
32-
echo -n "::set-output name=next_tag::"
33-
bump2version --list ${{ github.event.inputs.versionName }} | grep new_version | sed -r s,"^.*=",,
31+
python -m pip install bump-my-version
32+
echo -n "next_tag=" >> $GITHUB_OUTPUT
33+
allowed_pattern="^(major|minor|patch|[0-9]+\.[0-9]+\.[0-9]+)$"
34+
35+
if [[ ! ${{ github.event.inputs.versionName }} =~ $allowed_pattern ]]; then
36+
echo "Invalid version name:${{ github.event.inputs.versionName }}"
37+
exit 1
38+
fi
39+
40+
if [[ ${{ github.event.inputs.versionName }} =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
41+
echo "next_tag=${{ github.event.inputs.versionName }}" >> $GITHUB_OUTPUT
42+
else
43+
echo "next_tag=$(bump-my-version show-bump | grep${{ github.event.inputs.versionName }} | sed -r s,"^.*─ ",,)" >> $GITHUB_OUTPUT
44+
fi
3445
- name: Get main branch SHA
3546
id: base-sha
3647
run: echo "sha=$(git rev-parse origin/main)" >> $GITHUB_OUTPUT
@@ -46,7 +57,7 @@ jobs:
4657
if: steps.changed-py.outputs.any_changed == 'true'
4758
run: |
4859
cd src/client/packaging/pypi
49-
bump2version --allow-dirty --new-version ${{ steps.version.outputs.next_tag }} ignore_part
60+
bump-my-version --allow-dirty --new-version ${{ steps.version.outputs.next_tag }}
5061
- name: Create pull request into prod
5162
uses: peter-evans/create-pull-request@v3
5263
with:

requirements.dev.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
aiohttp==3.9.4
22
black>=20.8b1
3-
bump2version==1.0.1
43
covidcast==0.1.5
54
delphi_utils
65
docker==6.0.1

src/client/packaging/pypi/.bumpversion.cfg

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/client/packaging/pypi/pyproject.toml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,27 @@ dependencies = ["aiohttp", "delphi-utils", "requests>=2.7.0", "tenacity"]
4242
[project.urls]
4343
"Homepage" = "https://github.com/cmu-delphi/delphi-epidata"
4444
"Changelog" = "https://github.com/cmu-delphi/delphi-epidata/blob/main/src/client/packaging/pypi/CHANGELOG.md"
45+
46+
[tool.bumpversion]
47+
current_version = "4.1.23"
48+
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
49+
serialize = ["{major}.{minor}.{patch}"]
50+
search = "{current_version}"
51+
replace = "{new_version}"
52+
regex = false
53+
ignore_missing_version = false
54+
ignore_missing_files = false
55+
tag = false
56+
sign_tags = false
57+
tag_name = "v{new_version}"
58+
tag_message = "Bump version: {current_version} → {new_version}"
59+
allow_dirty = false
60+
commit = false
61+
message = "Bump version: {current_version} → {new_version}"
62+
commit_args = ""
63+
64+
[[tool.bumpversion.files]]
65+
filename = "../../delphi_epidata.py"
66+
67+
[[tool.bumpversion.files]]
68+
filename = "pyproject.toml"

0 commit comments

Comments
 (0)