summaryrefslogtreecommitdiffstats
path: root/ci/before_deploy.sh
blob: 4890f96bcf3025886909947c1e84d12ede3af23b (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
# `before_deploy` phase: here we package the build artifacts

set -ex

. $(dirname $0)/utils.sh

# Generate artifacts for release
mk_artifacts() {
    if is_ssse3_target; then
        RUSTFLAGS="-C target-feature=+ssse3" \
        cargo build --target $TARGET --release --features simd-accel
    else
        cargo build --target $TARGET --release
    fi
}

mk_tarball() {
    # create a "staging" directory
    local td=$(mktempd)
    local out_dir=$(pwd)
    local name="${PROJECT_NAME}-${TRAVIS_TAG}-${TARGET}"
    local gcc_prefix="$(gcc_prefix)"
    mkdir "${td:?}/${name}"
    mkdir "$td/$name/complete"

    cp target/$TARGET/release/rg "$td/$name/rg"
    ${gcc_prefix}strip "$td/$name/rg"
    cp {doc/rg.1,README.md,UNLICENSE,COPYING,LICENSE-MIT} "$td/$name/"
    cp \
      target/$TARGET/release/build/ripgrep-*/out/{rg.bash-completion,rg.fish,_rg.ps1} \
      "$td/$name/complete/"
    cp complete/_rg "$td/$name/complete/"

    pushd $td
    tar czf "$out_dir/$name.tar.gz" *
    popd
    rm -r $td
}

main() {
    mk_artifacts
    mk_tarball
}

main