diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cbfe5cd..5425f99 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -35,37 +35,35 @@ jobs: command: query version: unreleased - - name: Detect Version Bump Type + - name: Set Version Bump Type from GitVersion id: version-bump - if: github.ref == 'refs/heads/main' # Only update for stable releases + if: github.ref == 'refs/heads/main' run: | - CHANGELOG="${{ steps.extract-changelog.outputs.result }}" - echo "Extracted Changelog:" - echo "$CHANGELOG" - + VERSION_INCREMENT="${{ steps.gitversion.outputs.MajorMinorPatch }}" + TAG="${{ steps.gitversion.outputs.PreReleaseLabel }}" + # Default bump type BUMP_TYPE="patch" - if echo "$CHANGELOG" | grep -q "### Breaking Changes"; then + # Determine bump type based on GitVersion's calculated version + if [[ "$VERSION_INCREMENT" =~ ^[1-9][0-9]*\.0\.0$ ]]; then BUMP_TYPE="major" - elif echo "$CHANGELOG" | grep -q "### Removed"; then - BUMP_TYPE="major" - elif echo "$CHANGELOG" | grep -q "### Added"; then - BUMP_TYPE="minor" - elif echo "$CHANGELOG" | grep -q "### Deprecated"; then + elif [[ "$VERSION_INCREMENT" =~ ^[0-9]+\.[1-9][0-9]*\.0$ ]]; then BUMP_TYPE="minor" - elif echo "$CHANGELOG" | grep -q "### Changed"; then - BUMP_TYPE="minor" - elif echo "$CHANGELOG" | grep -q "### Fixed"; then - BUMP_TYPE="patch" - elif echo "$CHANGELOG" | grep -q "### Security"; then + 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 + echo "Version bump detected: $BUMP_TYPE" echo "bump_type=$BUMP_TYPE" >> $GITHUB_ENV + - 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 7381867..0a2285c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,13 @@ 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). -## [0.4.1] - 2025-02-24 +## [Unreleased] + +### Changed + +- Ensure that version numbers in ChangeLog and releases are in sync + +## [0.5.0] - 2025-02-24 ### Changed diff --git a/pyproject.toml b/pyproject.toml index 44a61ff..10dc09a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "xurrent" -version = "0.5.0" +version = "0.6.0-preview.11" 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.5.0" +version = "0.6.0-preview.11" description = "A python module to interact with the Xurrent API." authors = ["Ing. Fabian Franz Steiner BSc. "] readme = "README.md"