summaryrefslogtreecommitdiffstats
path: root/.travis/create_artifacts.sh
blob: 2c142e8d032f9860b1133a3e425b827ccab59c47 (plain)
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
#!/bin/bash
# shellcheck disable=SC2230

set -e

if [ ! -f .gitignore ]; then
	echo "Run as ./travis/$(basename "$0") from top level directory of git repository"
	exit 1
fi

if [ ! "${TRAVIS_REPO_SLUG}" == "netdata/netdata" ]; then
	echo "Beta mode on ${TRAVIS_REPO_SLUG}, not running anything here"
	exit 0
fi;

echo "--- Initialize git configuration ---"
export GIT_MAIL="bot@netdata.cloud"
export GIT_USER="netdatabot"
git config user.email "${GIT_MAIL}"
git config user.name "${GIT_USER}"
git checkout master
git pull

# Everything from this directory will be uploaded to GCS
mkdir -p artifacts
BASENAME="netdata-$(git describe)"

# Make sure stdout is in blocking mode. If we don't, then conda create will barf during downloads.
# See https://github.com/travis-ci/travis-ci/issues/4704#issuecomment-348435959 for details.
python -c 'import os,sys,fcntl; flags = fcntl.fcntl(sys.stdout, fcntl.F_GETFL); fcntl.fcntl(sys.stdout, fcntl.F_SETFL, flags&~os.O_NONBLOCK);'
echo "--- Create tarball ---"
autoreconf -ivf
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --with-zlib --with-math --with-user=netdata CFLAGS=-O2 
make dist
mv "${BASENAME}.tar.gz" artifacts/

echo "--- Create self-extractor ---"
./packaging/makeself/build-x86_64-static.sh

# Needed for GCS
echo "--- Copy artifacts to separate directory ---"
#shellcheck disable=SC2164
cp packaging/version artifacts/latest-version.txt
cd artifacts
ln -s "${BASENAME}.tar.gz" netdata-latest.tar.gz
ln -s "${BASENAME}.gz.run" netdata-latest.gz.run
sha256sum -b ./* >"sha256sums.txt"
echo "checksums:"
cat sha256sums.txt