File: create_release.sh

package info (click to toggle)
zim 0.76.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 10,952 kB
  • sloc: python: 68,612; xml: 1,270; javascript: 512; sh: 101; makefile: 47
file content (96 lines) | stat: -rwxr-xr-x 2,214 bytes parent folder | download | duplicates (2)
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/bin/bash
export LC_ALL=C.UTF-8

NEW="$1"
OLD=`python3 -c "import zim;print(zim.__version__)"`

SEMVER_REGEX="^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(\\-[0-9A-Za-z-]+(\\.[0-9A-Za-z-]+)*)?(\\+[0-9A-Za-z-]+(\\.[0-9A-Za-z-]+)*)?$"
if [[ ! "$NEW" =~ $SEMVER_REGEX ]]; then
  echo "Usage: $0 VERSION -- where version should match https://semver.org/ spec"
  exit 1
fi


# Update changelog

echo "Updating CHANGELOG.md"

TMP="/tmp/changelog.md"
DATE=`date +"%a %d %b %Y"` # Thu 28 Mar 2019
YEAR=`date +"%Y"`

head CHANGELOG.md -n 7 > $TMP
echo "##  $NEW - $DATE" >> $TMP
git log --pretty=format:"* %s" --first-parent $OLD.. | grep -vi '^* fixup' >> $TMP
echo "" >> $TMP
tail --lines=+7 CHANGELOG.md >> $TMP

vim $TMP || exit 1
cp $TMP CHANGELOG.md

# Update version numbers

echo "Updating zim/__init__.py to version $NEW copyright $YEAR"
sed -i "s/^__version__ =.*\$/__version__ = '$NEW'/" zim/__init__.py
sed -i "s/^__copyright__ =.*\$/__copyright__ = 'Copyright 2008 - $YEAR Jaap Karssenberg <jaap.karssenberg@gmail.com>'/" zim/__init__.py

echo "Updating website/pages/downloads.txt"
MONTH=`date +"%b %Y"`
sed -i "s/^=\+ Latest release: .*\$/===== Latest release: $NEW - $MONTH =====/" website/pages/downloads.txt


# Update debian version

echo "Updating debian/changelog"

DEBNEW=${NEW/-/~/} # Need "~" for release candidates in debian version
DEBDATE=`date +"%a, %d %b %Y %H:%M:%S %z"` #Thu, 28 Mar 2019 21:34:00 +0100

cat > ./debian/changelog << EOF
zim ($DEBNEW) unstable; urgency=medium

  * Update to release $DEBNEW

 -- Jaap Karssenberg <jaap.karssenberg@gmail.com>  $DEBDATE

EOF


# Update AppData

echo "Updating xdg/org.zim_wiki.Zim.appdata.xml"

./tools/add_release_to_appdata.py


# Build package & test it

echo "Building ..."

python3 ./test.py package || exit 1
make clean

./setup.py sdist
make builddeb
make clean

./tools/build_website.sh

lintian -Ivi ../zim_$DEBNEW\_*.changes


# Final steps are manual
cat << EOF

================================================================================

To finish release run:
git commit -a -m "Release $NEW"
git tag $NEW
git push
git push --tags

Then:
- Upload packages and html to website
- Email announcement to mailing list
EOF