diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9c04827..6dc8063 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -58,22 +58,26 @@ jobs: run: | VERSION_INCREMENT="${{ steps.gitversion.outputs.MajorMinorPatch }}" TAG="${{ steps.gitversion.outputs.PreReleaseLabel }}" - + # Default bump type BUMP_TYPE="patch" - # Determine bump type based on GitVersion's calculated version - if [[ "$VERSION_INCREMENT" =~ ^[1-9][0-9]*\.0\.0$ ]]; then - BUMP_TYPE="major" - elif [[ "$VERSION_INCREMENT" =~ ^[0-9]+\.[1-9][0-9]*\.0$ ]]; then - BUMP_TYPE="minor" - elif [[ "$VERSION_INCREMENT" =~ ^[0-9]+\.[0-9]+\.[1-9][0-9]*$ ]]; then - BUMP_TYPE="patch" - fi - - # Handle pre-release versions - if [[ -n "$TAG" ]]; then - BUMP_TYPE="pre${BUMP_TYPE}" + # If Python files changed → apply version logic + if [[ "${{ env.python_changed }}" == "true" ]]; then + if [[ "$VERSION_INCREMENT" =~ ^[1-9][0-9]*\.0\.0$ ]]; then + BUMP_TYPE="major" + elif [[ "$VERSION_INCREMENT" =~ ^[0-9]+\.[1-9][0-9]*\.0$ ]]; then + BUMP_TYPE="minor" + elif [[ "$VERSION_INCREMENT" =~ ^[0-9]+\.[0-9]+\.[1-9][0-9]*$ ]]; then + BUMP_TYPE="patch" + fi + + # Handle pre-release versions + if [[ -n "$TAG" ]]; then + BUMP_TYPE="pre${BUMP_TYPE}" + fi + else + echo "No Python files changed → forcing patch bump." fi echo "Version bump detected: $BUMP_TYPE" @@ -81,6 +85,7 @@ jobs: + - name: Update CHANGELOG.md if: github.ref == 'refs/heads/main' # Only update for stable releases uses: release-flow/keep-a-changelog-action@v3.0.0 diff --git a/CHANGELOG.md b/CHANGELOG.md index 60d0955..da2e1c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +### Changed + +- **GitHub Actions Workflow** + - Modified the version bump logic in `.github/workflows/release.yml` to apply major/minor/patch logic only if Python files have changed. If no Python files changed, the workflow now forces a patch bump to prevent unintended major or minor releases. + + ## [0.8.0] - 2025-06-13 ### Added diff --git a/pyproject.toml b/pyproject.toml index 9af823d..b1e9d1d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "xurrent" -version = "0.8.0" +version = "0.9.0-preview.2" authors = [ { name="Fabian Steiner", email="fabian@stei-ner.net" }, ] @@ -18,7 +18,7 @@ Homepage = "https://github.com/fasteiner/xurrent-python" Issues = "https://github.com/fasteiner/xurrent-python/issues" [tool.poetry] name = "xurrent" -version = "0.8.0" +version = "0.9.0-preview.2" description = "A python module to interact with the Xurrent API." authors = ["Ing. Fabian Franz Steiner BSc. "] readme = "README.md"