forked from flathub/com.tutanota.Tutanota
-
Notifications
You must be signed in to change notification settings - Fork 1
/
generate.bash
executable file
·61 lines (51 loc) · 1.76 KB
/
generate.bash
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
#!/bin/bash
set -eu
# get the correct commit from the tutanota repo (last tag that matches tutanota-release*)
[ -d tutanota ] || git clone --depth 20 https://github.com/tutao/tutanota.git
cd tutanota
git fetch
TAG=`git describe --tags $(git rev-list --tags --max-count=1) --match "tutanota-desktop-release-*"`
if [[ $TAG == tutanota-desktop-release-* ]]; then
echo $TAG
else
echo "tag ${TAG} doesn't match tutanota-desktop-release-*"
exit 1
fi
VERSION=`echo ${TAG:25}`
ARCHIVE="tutanota-desktop-${VERSION}-unpacked-linux.tar.gz"
URL="https://github.com/tutao/tutanota/releases/download/${TAG}/${ARCHIVE}"
CHANGELOG_URL="https://github.com/tutao/tutanota/releases/${TAG}"
DATE=`date +"%Y-%m-%d"`
git checkout -f "${TAG}"
# generate the client
npm install
npm run build-packages
node desktop --unpacked --custom-desktop-release
cd ..
echo "packing client"
(cd ./tutanota/build/desktop && tar -czvf ../../../${ARCHIVE} ./linux-unpacked > /dev/null)
CHECKSUM=`sha256sum ${ARCHIVE} | head -c64`
echo SHA256 CHECKSUM:
echo "${CHECKSUM}"
# generate manifest
node ./manifest-template.js $CHECKSUM $URL
# update appdata
node ./appdata-update.js $VERSION $DATE $CHANGELOG_URL
${VISUAL:-${EDITOR:-vi}} ./com.tutanota.Tutanota.appdata.xml.tmp
mv ./com.tutanota.Tutanota.appdata.xml.tmp ./com.tutanota.Tutanota.appdata.xml
# clean up
rm -rf ./.idea ./generate-cache ./tutanota ./com.tutanota.Tutanota.appdata.xml.tmp
# new branch, git commit & push to flathub repo
git branch -D ${TAG} || true
git checkout -b ${TAG}
git add .
git commit -m "update to v${VERSION}"
git push -uf origin ${TAG}
git checkout master
echo ""
echo ""
echo "Done! Please remember to upload"
echo "${ARCHIVE}"
echo "to the assets of github release ${TAG} at"
echo "${CHANGELOG_URL}"
echo "(file url should be ${URL})"