<commit_before>#!/usr/bin/env bash

set -e

count=$(git status --porcelain | wc -l)
if test $count -gt 0; then
  git status
  echo "Not all files have been committed in Git. Release aborted"
  exit 1
fi

select_part() {
  local choice=$1
  case "$choice" in
      "Patch release")
          bumpversion patch
          ;;
      "Minor release")
          bumpversion minor
          ;;
      "Major release")
          bumpversion major
          ;;
      *)
          read -p "Version > " version
          bumpversion --new_version=$version $part
          ;;
  esac
}

# Look for a version tag in Git. If not found, ask the user to provide one
git describe --exact-match > /dev/null || (
  latest_version=$(git describe --abbrev=0)
  echo
  echo "Current commit has not been tagged with a version. Latest known version is $latest_version."
  PS3='What do you want to release? '
  options=("Patch release" "Minor release" "Major release" "Release with a custom version")
  select choice in "${options[@]}";
  do
    select_part "$choice"
    break
  done
  new_version=$(bumpversion --dry-run --list patch | grep current_version | sed -r s,"^.*=",,)
  # Bumpversion v0.5.3 does not support annotated tags
  git tag -a -m "PyPi release $new_version" $new_version
)

git push<commit_msg>Improve publish script<commit_after>#!/usr/bin/env bash

set -e

count=$(git status --porcelain | wc -l)
if test $count -gt 0; then
  git status
  echo "Not all files have been committed in Git. Release aborted"
  exit 1
fi

select_part() {
  local choice=$1
  case "$choice" in
      "Patch release")
          bumpversion patch
          ;;
      "Minor release")
          bumpversion minor
          ;;
      "Major release")
          bumpversion major
          ;;
      *)
          read -p "Version > " version
          bumpversion --new_version=$version $part
          ;;
  esac
}

git pull --tags
# Look for a version tag in Git. If not found, ask the user to provide one
git describe --exact-match > /dev/null || (
  latest_version=$(git describe --abbrev=00 | echo '0.0.1')
  echo
  echo "Current commit has not been tagged with a version. Latest known version is $latest_version."
  PS3='What do you want to release? '
  options=("Patch release" "Minor release" "Major release" "Release with a custom version")
  select choice in "${options[@]}";
  do
    select_part "$choice"
    break
  done
  new_version=$(bumpversion --dry-run --list patch | grep current_version | sed -r s,"^.*=",,)
  read -p "Release version $new_version? [y/N] >" ok
  if [ "$ok" != "y" ]; then
    echo "Release aborted"
    exit 1
  fi
  # Bumpversion v0.5.3 does not support annotated tags
  git tag -a -m "PyPi release $new_version" $new_version
)

git push
{'fraction_non_alphanumeric': 0.11391018619934283, 'fraction_numerical': 0.007667031763417305, 'mean_word_length': 2.5584415584415585, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1109786', 'n_tokens_mistral': 879, 'n_tokens_neox': 847, 'n_words': 319}