Skip to content
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions .bumpversion.toml
Original file line number Diff line number Diff line change
@@ -1,28 +1,31 @@
[tool.bumpversion]
current_version = "2025.04.0"
parse = "^(?P<year>\\d{4})\\.(?P<month>\\d{2})\\.(?P<patch>\\d+)$"
serialize = ["{year}.{month}.{patch}"]
parse = '^(?P<year>\d{4})\.(?P<month>\d{2})\.(?P<patch>\d+)$'
# ← use your part names here and pad month to two digits
serialize = ["{year}.{month:02d}.{patch}"]
tag = true
tag_name = "v{new_version}"
commit = true
message = "Release: {new_version}"

[tool.bumpversion.parts.year]
type = "calver"
calver_format = "%Y"
type = "calver"
# calver_format only affects how the part’s default or reset value is computed,
# you can leave this or remove if you don’t need it.

[tool.bumpversion.parts.month]
type = "calver"
calver_format = "%m"
type = "calver"
# likewise, calver_format here is optional once you’re formatting via Python sintax.

[tool.bumpversion.parts.patch]
type = "integer"
type = "integer"

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

[[tool.bumpversion.files]]
filename = "src/cpax/__init__.py"
ignore_missing_version = true
filename = "src/cpax/__init__.py"
search = '__version__ = "{current_version}"'
replace = '__version__ = "{new_version}"'
51 changes: 46 additions & 5 deletions .github/workflows/manual-release.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,65 @@
# .github/workflows/manual-release.yml
name: Manual CalVer Release

on:
workflow_dispatch:
inputs:
dry_run:
description: 'Dry-run only? (no commit, no push)'
type: boolean
default: true

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
tags: true

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

- name: Install bump-my-version
run: pip install bump-my-version

- name: Bump version
- name: Compute & (dry-)apply CalVer bump
env:
INPUT_DRY_RUN: ${{ github.event.inputs.dry_run }}
run: |
bump-my-version bump patch
git push origin HEAD --follow-tags
set -e
# If `DRY_RUN` was passed via act CLI, keep it; else use the workflow‐dispatch input
DRY_RUN="${DRY_RUN:-$INPUT_DRY_RUN}"
echo "DRY_RUN is: '$DRY_RUN'"
# 1) Get latest tag or empty
LATEST=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
YEAR=$(date +%Y) # calendar year
MONTH=$(date +%m) # zero-padded month
PREFIX="v${YEAR}.${MONTH}"
if [[ "$LATEST" == $PREFIX.* ]]; then
SEQ=${LATEST##*.}
NEXT_SEQ=$((SEQ + 1))
else
NEXT_SEQ=0
fi
NEW_VERSION="${YEAR}.${MONTH}.${NEXT_SEQ}"
echo "Next version will be ${NEW_VERSION}"
# Build the bump command
CMD="bump-my-version bump --new-version ${NEW_VERSION}"
if [[ "$DRY_RUN" == 'true' ]]; then
CMD+=" --dry-run --verbose --no-commit --no-tag"
fi
echo "Running: $CMD"
# expose DRY_RUN to all later steps
echo "DRY_RUN=$DRY_RUN" >> $GITHUB_ENV
$CMD
- name: Push changes
if: env.DRY_RUN == 'false'
run: git push origin HEAD --follow-tags
3 changes: 1 addition & 2 deletions src/cpax/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# cpax/__init__.py

from importlib.metadata import version
__version__ = version("cpax")
__version__ = "2025.04.0"

# Import submodules but don’t expose specific functions
from . import ode