-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrelease.sh
executable file
·33 lines (24 loc) · 1010 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
#!/bin/bash
# Create a zip file containing the source code including submodules
# Usage: release <version>
option="$1"
file_name="antenna-tuner"
version_major=$(cat "$file_name.ino" | grep '#define VERSION_MAJOR' | awk -F' ' '{print $3}')
version_minor=$(cat "$file_name.ino" | grep '#define VERSION_MINOR' | awk -F' ' '{print $3}')
version_maint=$(cat "$file_name.ino" | grep '#define VERSION_MAINT' | awk -F' ' '{print $3}')
version="$version_major.$version_minor.$version_maint"
if [[ -z $version ]]; then
echo "Error: No version string specified"
exit 1
fi
sed -i -e "s/.* * Version:.*/ * Version: $version/" "$file_name.ino"
sed -i -e "s/.* * Date:.*/ * Date: $(date '+%B %d, %Y')/" "$file_name.ino"
rm -rf "$file_name.ino-e"
rm -rf "$file_name-"*"-full"*
rm -rf "$file_name"
rm -rf "$file_name "*
make clean
if [[ "$option" != "clean" ]]; then
cd .. && zip -r "$file_name/$file_name-$version-full.zip" "$file_name" -x '*.git*' '*.vscode*' '*private*' '*build-*' '*.DS_Store*'
fi
exit 0