-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathrelease.sh
executable file
·35 lines (26 loc) · 1015 Bytes
/
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
#!/bin/bash
set -e
MODULE_XML_PATH="etc/module.xml"
COMPOSER_JSON_PATH="composer.json"
# Check for uncommitted changes.
if (! git diff-index --quiet HEAD --); then
echo "There are uncommitted changes, please commit them. Exiting..."
exit
fi
# Get expected version.
echo "What version are you releasing?"
read release_version
# Check for XML versions
if (! grep "setup_version=\"$release_version\"" $MODULE_XML_PATH > /dev/null); then
echo "$MODULE_XML_PATH does not contain the right version. Exiting..."
exit
fi
if (! grep "\"version\": \"$release_version\"" $COMPOSER_JSON_PATH > /dev/null); then
echo "$COMPOSER_JSON_PATH does not contain the right version. Exiting..."
exit
fi
echo "All versions check out. Generating tarball..."
git archive --format=zip HEAD > drip_m2connect-$(echo -n $release_version | tr '.' '_')-$(date "+%Y-%m-%d").zip
git tag -a -m "Version $release_version" "$release_version"
git push origin "$release_version"
echo "Tarball generated and tag created and pushed."