pe-parse/util/release
William Woodruff 4880b14a13
CI: Automatic pepy releases to PyPI (#131)
* workflows/release: Add PyPI release config

* util/release: Don't push to PyPI manually

The CI will handle this for us from now on.

* VERSION: 1.1.0.rc.1

* workflows/release: Try on this branch

* workflows/release: Syntax

* workflows/release: Disable on this branch

* VERSION: 1.1.0.rc.2
2020-04-20 14:57:01 -04:00

38 lines
953 B
Bash
Executable File

#!/usr/bin/env bash
# release: perform the chore work required for a pe-parse/pepy release
set -eo pipefail
function installed {
cmd=$(command -v "${1}")
[[ -n "${cmd}" ]] && [[ -f "${cmd}" ]]
return ${?}
}
function die {
>&2 echo "Barf: ${*}"
exit 1
}
# Fail early if we don't have the expected tools.
for tool in git python3 twine; do
installed "${tool}" || die "Missing dependency: ${tool}"
done
# Fail early if `git status` reports any untracked changes.
[[ -n $(git status -s) ]] && die "Untracked changes in repo"
# Next, check the VERSION in version and make sure it doesn't already have a git tag.
[[ -f ./VERSION ]] || die "Missing VERSION file; wrong directory?"
version=v$(<./VERSION)
[[ -n $(git tag -l "${version}") ]] && die "git tag for ${version} already exists!"
# Next, craft a tag for the current HEAD. Push both the current commit and the tag.
git tag "${version}"
git push
git push origin "${version}"
echo OK