heptapod-make-push-tarball.sh 1.08 KB
Newer Older
1
2
3
4
5
6
#!/bin/sh

set -e

if echo "$CI_COMMIT_TAG" | grep '^heptapod-'; then
    TARBALL=$(echo -n $CI_COMMIT_TAG | sed s/heptapod/heptapod-rails/g)
7
8
9
10
11
    # pulling on the current branch and the two main heptapod ones
    # so that `hg archive` should see the tag (very unlikely the tagging
    # changeset would be elsewhere, not worth pulling the whole repo)
    # using `hg log` instead of `hg branch` to avoid newline for safety
    hg pull -r heptapod -r heptapod-stable -r `hg log -r. -T "{branch}"` || /bin/true
12
    SUBDIR=public
13
14
else
    TARBALL=heptapod-rails-$(hg log -r. -T "{node}")
15
    SUBDIR=public/intermediate
16
17
18
19
20
21
22
23
24
25
26
27
fi

# it's nicer for console output to add the extension right away
TARBALL=${TARBALL}.tar.gz

TARBALL_PATH=/tmp/${TARBALL}

echo "Generating ${TARBALL}"
hg archive -t tgz ${TARBALL_PATH}
sha256sum ${TARBALL_PATH} > ${TARBALL_PATH}.sha256sum

if [ -n "$HEPTAPOD_TARBALL_UPLOAD_KEY" ]; then
28
    `dirname $0`/heptapod-sftp-push \
29
                upload.heptapod.net \
30
31
32
                "$HEPTAPOD_TARBALL_UPLOAD_KEY" \
                "$TARBALL_PATH" \
                "${SUBDIR}/src"
33
fi