Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
54 changes: 40 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,21 +62,50 @@ jobs:
- name: Determine version bump type
id: version
run: |
# Extract current version from pyproject.toml
current_version=$(grep -E '^version = "' pyproject.toml | cut -d'"' -f2)
# Extract current version from __init__.py
current_version=$(grep -E '^__version__ = "' src/sprout/__init__.py | cut -d'"' -f2)
echo "Current version: $current_version"

# Analyze changelog to determine bump type
major_changes=$(sed -n '/## \[Unreleased\]/,/## \[/p' CHANGELOG.md | grep -E "^### (Removed)" || true)
minor_changes=$(sed -n '/## \[Unreleased\]/,/## \[/p' CHANGELOG.md | grep -E "^### (Added|Changed|Deprecated)" || true)
patch_changes=$(sed -n '/## \[Unreleased\]/,/## \[/p' CHANGELOG.md | grep -E "^### (Fixed|Security)" || true)
# Extract the Unreleased section
unreleased_section=$(sed -n '/## \[Unreleased\]/,/## \[/p' CHANGELOG.md)

# Determine bump type (check in order: major -> minor -> patch)
if [ -n "$major_changes" ]; then
# Check for sections with actual entries (lines starting with -)
major_entries=""
minor_entries=""
patch_entries=""

# Check if Removed section has entries
if echo "$unreleased_section" | grep -q "^### Removed"; then
major_entries=$(echo "$unreleased_section" | sed -n '/### Removed/,/^###\|^##/p' | grep "^- " || true)
fi

# Check if Added/Changed/Deprecated sections have entries
for section in "Added" "Changed" "Deprecated"; do
if echo "$unreleased_section" | grep -q "^### $section"; then
section_entries=$(echo "$unreleased_section" | sed -n "/### $section/,/^###\|^##/p" | grep "^- " || true)
if [ -n "$section_entries" ]; then
minor_entries="$minor_entries$section_entries"
fi
fi
done

# Check if Fixed/Security sections have entries
for section in "Fixed" "Security"; do
if echo "$unreleased_section" | grep -q "^### $section"; then
section_entries=$(echo "$unreleased_section" | sed -n "/### $section/,/^###\|^##/p" | grep "^- " || true)
if [ -n "$section_entries" ]; then
patch_entries="$patch_entries$section_entries"
fi
fi
done

# Determine bump type based on actual entries
if [ -n "$major_entries" ]; then
bump_type="major"
elif [ -n "$minor_changes" ]; then
elif [ -n "$minor_entries" ]; then
bump_type="minor"
elif [ -n "$patch_changes" ]; then
elif [ -n "$patch_entries" ]; then
bump_type="patch"
else
# Default to patch if only individual items without category
Expand Down Expand Up @@ -180,10 +209,7 @@ jobs:

- name: Update version in files
run: |
# Update pyproject.toml
sed -i 's/version = ".*"/version = "${{ needs.prepare-release.outputs.version }}"/' pyproject.toml

# Update __init__.py
# Update __init__.py (pyproject.toml reads version from here dynamically)
sed -i 's/__version__ = ".*"/__version__ = "${{ needs.prepare-release.outputs.version }}"/' src/sprout/__init__.py

# Update CHANGELOG.md
Expand All @@ -199,7 +225,7 @@ jobs:
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add pyproject.toml src/sprout/__init__.py CHANGELOG.md
git add src/sprout/__init__.py CHANGELOG.md
git commit -m "Release version ${{ needs.prepare-release.outputs.version }}"

- name: Build package
Expand Down
27 changes: 1 addition & 26 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

### Changed

### Deprecated

### Removed

### Fixed

### Security

## [1.0.0] - 2025-06-27

### Added
- Initial implementation of sprout CLI tool
- `create` command to create new git worktrees with Docker Compose support
Expand All @@ -34,15 +20,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- CI/CD pipeline with GitHub Actions
- Support for Python 3.11, 3.12, and 3.13

### Changed

### Deprecated

### Removed

### Fixed

### Security

[Unreleased]: https://github.com/SecDev-Lab/sprout/compare/v1.0.0...HEAD
[1.0.0]: https://github.com/SecDev-Lab/sprout/compare/v1.0.0...HEAD
[Unreleased]: https://github.com/SecDev-Lab/sprout/compare/v0.1.0...HEAD
12 changes: 9 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "sprout-cli"
version = "1.0.0"
dynamic = ["version"]
description = "CLI tool to automate git worktree and Docker Compose development workflows"
readme = "README.md"
requires-python = ">=3.11"
Expand Down Expand Up @@ -41,6 +41,9 @@ dev = [
[project.scripts]
sprout = "sprout.__main__:main"

[tool.hatch.version]
path = "src/sprout/__init__.py"

[tool.hatch.build.targets.wheel]
packages = ["src/sprout"]

Expand All @@ -54,7 +57,7 @@ include = [
]

[tool.ruff]
target-version = "1.0.0"
target-version = "py313"
line-length = 100

[tool.ruff.lint]
Expand All @@ -67,6 +70,9 @@ select = [
"C4", # flake8-comprehensions
"UP", # pyupgrade
]
ignore = [
"UP040", # TypeAlias annotations - not compatible with typer
]

[tool.ruff.lint.per-file-ignores]
"tests/*" = ["S101", "S103"]
Expand Down Expand Up @@ -96,7 +102,7 @@ exclude_lines = [
]

[tool.mypy]
python_version = "1.0.0"
python_version = "3.11"
warn_return_any = true
warn_unused_configs = true
disallow_untyped_defs = true
Expand Down
2 changes: 1 addition & 1 deletion src/sprout/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""sprout - CLI tool to automate git worktree and Docker Compose development workflows."""

__version__ = "1.0.0"
__version__ = "0.1.0"