-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.sh
59 lines (54 loc) · 2.14 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
#!/bin/bash
# PlatformInfo Release Script
# Run: ./release.sh
if ! which gh 2>&1 > /dev/null; then
echo "GitHub CLI not found - gh"
exit
fi
echo 'PlatformInfo Release'
echo
echo 'Do not create the tag beforehand - this gh release create does that for you!'
echo
echo 'Enter the version number (e.g. 1.2.3): '
read version
echo "You entered '$version', is that correct? [Yn]"
read confirm1
if [ "$confirm1" == "Y" ]; then
echo "Thanks for your confirmation."
if gh release list | grep --quiet "$version"; then
echo 'This tag has already been used. Exiting'
exit -1
fi
echo "Generating notes file..."
echo "Release $version" > notes.txt
echo "See: https://github.com/newtovaux/platforminfo/blob/main/CHANGELOG.md" >> notes.txt
# Does the notes.txt file exist?
if [ -f "notes.txt" ]; then
# Does the tag you're trying to release exist as "Stable tag:"" in the readme.txt?
if grep --quiet "Stable tag: $version" readme.txt; then
# Does the tag you're trying to release have a version entry in the readme.txt?
if grep --quiet "^#### $version ####" readme.txt; then
# Does the tag you're trying to release have a version entry in platforminfo.php?
if grep --quiet "* Version: $version" platforminfo.php; then
# Does the tag you're trying to release have a version entry in the Changelog?
if grep --quiet "## $version ##" CHANGELOG.md; then
# Create release with specified version
gh release create "$version" -F notes.txt -t "$version"
else
echo "Unable to find ## $version ## in CHANGELOG.md"
fi
else
echo "Unable to find * Version: $version in platforminfo.php"
fi
else
echo "Unable to find #### $version #### in readme.txt"
fi
else
echo "Unable to find Stable tag $version in readme.txt"
fi
else
echo "Unable to find notes.txt"
fi
else
echo "Not confirmed."
fi