forked from ximion/appstream
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.sh
executable file
·72 lines (59 loc) · 1.89 KB
/
release.sh
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
#!/bin/bash
#
# Create LibAppStream release tarball from version control system
#
set -e
OPTION_SPEC="version:,git-tag:,sign"
PARSED_OPTIONS=$(getopt -n "$0" -a -o h --l "$OPTION_SPEC" -- "$@")
eval set -- "$PARSED_OPTIONS"
if [ $? != 0 ] ; then usage ; exit 1 ; fi
while true ; do
case "$1" in
--version ) case "$2" in
"") echo "version parameter needs an argument!"; exit 3 ;;
*) export APPSTREAM_VERSION=$2 ; shift 2 ;;
esac ;;
--git-tag ) case "$2" in
"") echo "git-tag parameter needs an argument!"; exit 3 ;;
*) export GIT_TAG=$2 ; shift 2 ;;
esac ;;
--sign ) SIGN_RELEASE=1; shift; ;;
--) shift ; break ;;
* ) echo "ERROR: unknown flag $1"; exit 2;;
esac
done
if [ "$APPSTREAM_VERSION" = "" ]; then
echo "No AppStream version set!"
exit 1
fi
if [ "$GIT_TAG" = "" ]; then
echo "No Git tag set!"
exit 1
fi
rm -rf ./release-tar-tmp
# check if we can build AppStream
make -C build clean all documentation
mkdir -p ./release-tar-tmp
git archive --prefix="AppStream-$APPSTREAM_VERSION/" "$GIT_TAG^{tree}" | tar -x -C ./release-tar-tmp
R_ROOT="./release-tar-tmp/AppStream-$APPSTREAM_VERSION"
# add precompiled documentation to the release tarball
rm -r $R_ROOT/docs
cp -dpr ./docs $R_ROOT/docs
# cleanup files which should not go to the release tarball
find ./release-tar-tmp -name .gitignore -type f -delete
find ./release-tar-tmp -name '*~' -type f -delete
find ./release-tar-tmp -name '*.bak' -type f -delete
find ./release-tar-tmp -name '*.o' -type f -delete
rm -f $R_ROOT/.travis.yml
rm $R_ROOT/release.sh
# create release tarball
cd ./release-tar-tmp
tar cvJf "AppStream-$APPSTREAM_VERSION.tar.xz" "./AppStream-$APPSTREAM_VERSION/"
mv "AppStream-$APPSTREAM_VERSION.tar.xz" ../
cd ..
# cleanup
rm -r ./release-tar-tmp
# sign release, if flag is set
if [ "$SIGN_RELEASE" = "1" ]; then
gpg --armor --sign --detach-sig "AppStream-$APPSTREAM_VERSION.tar.xz"
fi