-
Notifications
You must be signed in to change notification settings - Fork 6
/
create_release.sh
37 lines (32 loc) · 1.03 KB
/
create_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
#!/bin/bash
### Usage: ./create_release.sh v0.0.3
## check if README.md contains version description
## check if CHANGELOG.md contains version description
## update package.json version number
## create github tag and push it.
NEW_VERSION=$1
FOUND_README=1
FOUND_CHANGELOG=1
echo "Creating version $NEW_VERSION..."
echo "Check if README.md contains version description"
if grep -q "^### $NEW_VERSION$" "README.md"; then
echo "version found in README.md. ok";
FOUND_README=0;
else
echo "ERROR: version not found in README.md.";
FOUND_README=1;
fi
echo "Check if CHANGELOG.md contains version description"
if grep -q "^## \[$NEW_VERSION\]$" "CHANGELOG.md"; then
echo "version found in CHANGELOG.md. ok";
FOUND_CHANGELOG=0;
else
echo "ERROR: version not found in CHANGELOG.md.";
FOUND_CHANGELOG=1;
fi
if [ "$FOUND_README" = "0" ] && [ "$FOUND_CHANGELOG" = "0" ] ; then
echo "go push new version on github"
git tag -a $NEW_VERSION -m "releasing version $NEW_VERSION" && git push origin --tags
else
exit 1
fi