diff --git a/git-cliff-release/action.yaml b/git-cliff-release/action.yaml index 9e1634d..1d5428a 100644 --- a/git-cliff-release/action.yaml +++ b/git-cliff-release/action.yaml @@ -88,8 +88,10 @@ runs: elif [[ '${{ inputs.release_type }}' = auto ]]; then version_number=$(git-cliff --bumped-version | sed s/^v//) - # If there are no commits that increase semver, break - if [[ "$(git describe --tags --abbrev=0)" = "v${version_number}" ]]; then + # If there are no commits that increase semver, break. + # In a repo with no tags yet there is always something to release, and + # git describe would fail with a non-zero exit - guard against that. + if latest_tag=$(git describe --tags --abbrev=0 2> /dev/null) && [[ "$latest_tag" = "v${version_number}" ]]; then echo "::error title=Nothing to release::There were no commits that trigger a version bump since the last release" exit 1 fi diff --git a/git-cliff-release/cliff.toml b/git-cliff-release/cliff.toml index 67368d1..2f34c6a 100644 --- a/git-cliff-release/cliff.toml +++ b/git-cliff-release/cliff.toml @@ -61,6 +61,9 @@ trim = true postprocessors = [] [bump] +# Version used for repositories with no existing tags. The "v" prefix keeps it +# matching tag_pattern, so setting up a brand-new repo works out of the box. +initial_tag = "v0.1.0" # With 0.x.y version, breaking commits should only increase the minor version and feature commits should only increase the patch version breaking_always_bump_major = false features_always_bump_minor = false