-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathdo_release
More file actions
executable file
·70 lines (51 loc) · 1.55 KB
/
do_release
File metadata and controls
executable file
·70 lines (51 loc) · 1.55 KB
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
69
#!/bin/bash
# Create a new edi release that can be uploaded to a repository.
#
# usage: do_release 1.2.1
set -e
set -o errexit
set -o pipefail
if [ -z ${1} ]
then
>&2 echo "Error: Usage: ${0} VERSION"
exit 1
fi
set -o nounset
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd ${SCRIPTDIR}
if [ "$(git rev-parse --abbrev-ref HEAD)" != "develop" ]
then
>&2 echo "Error: please switch to the develop branch before doing a release!"
exit 1
fi
if ! git diff --exit-code --quiet
then
>&2 echo "Error: there are unstaged changes!"
exit 1
fi
if ! git diff --cached --exit-code --quiet
then
>&2 echo "Error: there are uncommitted changes!"
exit 1
fi
git clean -dxf
source /etc/os-release
NEW_VERSION="${1}"
PYPROJECT_TOML="pyproject.toml"
sed -i "s/^version = .*/version = \"${NEW_VERSION}\"/g" ${PYPROJECT_TOML}
git add ${PYPROJECT_TOML}
SPHINX_CONFIG="docs/conf.py"
sed -i "s/^version =.*/version = '${NEW_VERSION}'/g" ${SPHINX_CONFIG}
sed -i "s/^release =.*/release = '${NEW_VERSION}'/g" ${SPHINX_CONFIG}
git add ${SPHINX_CONFIG}
VERSION_HELPERS="edi/lib/versionhelpers.py"
sed -i "s/^edi_fallback_version =.*/edi_fallback_version = '${NEW_VERSION}'/g" ${VERSION_HELPERS}
git add ${VERSION_HELPERS}
gbp dch --new-version ${NEW_VERSION} --release --distribution ${VERSION_CODENAME} --debian-branch develop --debian-tag v%\(version\)s
git add debian/changelog
git commit -m "New version ${NEW_VERSION}."
git flow release start ${NEW_VERSION}
git flow release finish
git push origin master
git push origin develop
git push --tags