File: release-new-version-github

package info (click to toggle)
pyglossary 5.0.9-1
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,896 kB
  • sloc: python: 46,165; sh: 308; javascript: 100; xml: 42; makefile: 28
file content (68 lines) | stat: -rwxr-xr-x 1,600 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/bash
set -e

function yes_or_no {
	while true; do
		read -r -p "$* [y/n]: " yn
		case $yn in
		[Yy]*) return 0 ;;
		[Nn]*)
			echo "Aborted"
			return 1
			;;
		esac
	done
}

# function pip-has-version() {
# 	pip $PIP_OPTS index versions pyglossary --pre --ignore-requires-python | grep "$1,"
# }

CUR_VERSION=$($(dirname "$0")/version-core)

VERSION=$1
if [ -z "$VERSION" ]; then
	echo "Usage: $0 VERSION"
	echo "Current version: $CUR_VERSION"
	exit 1
fi

set -x

$(dirname "$0")/version-set.py "$VERSION"

git add setup.py pyglossary/core.py pyproject.toml about _license-dialog
git commit -m "version $VERSION" || echo "------ Already committed"
git -p show || true
git -p log || true

echo "Pushing to origin..."
git push

echo "Waiting for pypi release..."
while ! pip $PIP_OPTS install "pyglossary==$VERSION"; do
	sleep 5
done

echo "-------------- Check version in GUI: --------------"

~/.local/bin/pyglossary || true

yes_or_no "Continue creating the release?" || exit 1

echo "Creating tag $VERSION"
if ! git tag -a -m "version $VERSION" "$VERSION"; then
	echo "------ Already tagged"
	CUR_VERSION=$(git describe --abbrev=0 --tags $(git rev-list --tags --skip=1 --max-count=1))
fi

echo "Pushing tag to origin..."
git push origin "$VERSION"

MD_PATH=$(realpath $(dirname $0)/../doc/releases/$VERSION.md)
echo -e "## What's Changed\n" >"$MD_PATH"
git log --pretty='- %h %s' --reverse "$CUR_VERSION..$VERSION" >>"$MD_PATH"
echo -e "\n\n**Full Changelog**: https://github.com/ilius/pyglossary/compare/$CUR_VERSION...$VERSION\n" >>"$MD_PATH"

echo "Created $MD_PATH"
xdg-open "$MD_PATH"