-
Notifications
You must be signed in to change notification settings - Fork 0
/
createRelease.sh
executable file
·54 lines (41 loc) · 1.38 KB
/
createRelease.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
#!/bin/bash
# This script is used to create a release of the project.
# Check if the -h or --help flag is passed
if [ "$1" == "-h" ] || [ "$1" == "--help" ]; then
echo "Usage: $0 <version>"
echo
echo "This script is used to create a release of the project."
echo
echo "Arguments:"
echo " <version> The version number for the release."
echo
echo "Options:"
echo " -h, --help Show this help message and exit."
exit 0
fi
if [ -z "$1" ]; then
echo "Error: Please provide the version number as an argument."
echo "Usage: $0 <version>"
exit 1
fi
mkdir -p release
# First we build the binary with the version tag
echo "Building the project with version $1"
date=$(date)
go build --ldflags "-X 'main.version=$1' -X 'main.compileDate=$date'" -o release/haaukins-daemon-$1-linux-64bit
chmod +x release/haaukins-daemon-$1-linux-64bit
# cp database folder to release
cp -r database release/
# cp config folder to release
cp -r config release/
# cp nginx folder to release
cp -r nginx release/
# cp the systemd service file to release
cp haaukins-daemon.service release/
# cd to release folder
cd release
# Create the tarball
echo "Creating the tarball"
tar -czf haaukins-daemon-$1-linux-64bit.tar.gz haaukins-daemon-$1-linux-64bit database config nginx haaukins-daemon.service
# remove everything exept the build binary and tarball
rm -rf database config nginx haaukins-daemon.service