summaryrefslogtreecommitdiffstats
path: root/.github/scripts/package-upload.sh
blob: 13d63b4a74c3ea5caedfd307ea83a4a72f72bb87 (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
#!/bin/sh

set -e

host="packages.netdata.cloud"
user="netdatabot"

distro="${1}"
arch="${2}"
format="${3}"
repo="${4}"

staging="${TMPDIR:-/tmp}/package-staging"
prefix="/home/netdatabot/incoming/${repo}/"

packages="$(find artifacts -name "*.${format}")"

mkdir -p "${staging}"

case "${format}" in
    deb)
        src="${staging}/${distro}"
        mkdir -p "${src}"

        for pkg in ${packages}; do
            cp "${pkg}" "${src}"
        done
        ;;
    rpm)
        src="${staging}/${distro}/${arch}/"
        mkdir -p "${src}"

        for pkg in ${packages}; do
            cp "${pkg}" "${src}"
        done
        ;;
    *)
        echo "Unrecognized package format ${format}."
        exit 1
        ;;
esac

rsync -vrptO "${staging}/" "${user}@${host}:${prefix}"