#!/usr/bin/env bash # # bats-core git releaser # ## Usage: %SCRIPT_NAME% [options] ## ## Options: ## --major Major version bump ## --minor Minor version bump ## --patch Patch version bump ## ## -v, --version Print version ## --debug Enable debug mode ## -h, --help Display this message ## set -Eeuo pipefail DIR=$(cd "$(dirname "${0}")" && pwd) THIS_SCRIPT="${DIR}/$(basename "${0}")" BATS_VERSION=$( # shellcheck disable=SC1090 source <(grep '^export BATS_VERSION=' libexec/bats-core/bats) echo "${BATS_VERSION}" ) declare -r DIR declare -r THIS_SCRIPT declare -r BATS_VERSION BUMP_INTERVAL="" NEW_BATS_VERSION="" main() { handle_arguments "${@}" if [[ "${BUMP_INTERVAL:-}" == "" ]]; then echo "${BATS_VERSION}" exit 0 fi local NEW_BATS_VERSION NEW_BATS_VERSION=$(semver bump "${BUMP_INTERVAL}" "${BATS_VERSION}") declare -r NEW_BATS_VERSION local BATS_RELEASE_NOTES="/tmp/bats-release-${NEW_BATS_VERSION}" echo "Releasing: ${BATS_VERSION} to ${NEW_BATS_VERSION}" echo echo "Ensure docs/CHANGELOG.md is correctly updated" replace_in_files write_changelog git diff --staged cat </dev/null get_version() { echo "${THIS_SCRIPT_VERSION:-0.1}" } main "${@}"