-
Notifications
You must be signed in to change notification settings - Fork 3
/
make_release.sh
executable file
·85 lines (68 loc) · 1.42 KB
/
make_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
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/bin/bash
set -e
RELEASE_DIR=${HOME}/Releases
GITHUB_USER=OpenConextApps
PROJECT_NAME=php-voot-provider
if [ -z "$1" ]
then
cat << EOF
Please specify the tag or branch to make a release of.
Examples:
sh make_release.sh 0.1.0
sh make_release.sh master
sh make_release.sh develop
If you want to GPG sign the release, you can specify the "sign" parameter, this will
invoke the gpg command line tool to sign it.
sh make_release 0.1.0 sign
EOF
exit 1
else
TAG=$1
fi
mkdir -p ${RELEASE_DIR}
rm -rf ${RELEASE_DIR}/${PROJECT_NAME}-${TAG}
# get Composer
(
cd ${RELEASE_DIR}
curl -O https://getcomposer.org/composer.phar
)
# clone the tag
(
cd ${RELEASE_DIR}
git clone -b ${TAG} https://github.com/${GITHUB_USER}/${PROJECT_NAME}.git ${PROJECT_NAME}-${TAG}
)
# run Composer
(
cd ${RELEASE_DIR}/${PROJECT_NAME}-${TAG}
php ${RELEASE_DIR}/composer.phar install
)
# remove Git and Composer files
(
cd ${RELEASE_DIR}/${PROJECT_NAME}-${TAG}
rm -rf .git
rm -f .gitignore
rm -f composer.json
rm -f composer.lock
rm -f make_release.sh
)
# create tarball
(
cd ${RELEASE_DIR}
tar -czf ${PROJECT_NAME}-${TAG}.tar.gz ${PROJECT_NAME}-${TAG}
)
# create checksum file
(
cd ${RELEASE_DIR}
shasum ${PROJECT_NAME}-${TAG}.tar.gz > ${PROJECT_NAME}-${TAG}.sha
)
# sign it if requested
(
if [ -n "$2" ]
then
if [ "$2" == "sign" ]
then
cd ${RELEASE_DIR}
gpg -o ${PROJECT_NAME}-${TAG}.sha.gpg --clearsign ${PROJECT_NAME}-${TAG}.sha
fi
fi
)