summaryrefslogtreecommitdiffstats
path: root/ci/before_deploy.sh
diff options
context:
space:
mode:
Diffstat (limited to 'ci/before_deploy.sh')
-rw-r--r--ci/before_deploy.sh37
1 files changed, 37 insertions, 0 deletions
diff --git a/ci/before_deploy.sh b/ci/before_deploy.sh
new file mode 100644
index 0000000..05ec68c
--- /dev/null
+++ b/ci/before_deploy.sh
@@ -0,0 +1,37 @@
+# This script takes care of building your crate and packaging it for release
+
+set -ex
+
+main() {
+ # We run tests only once, and won't try to create any additional artifacts
+ if [ -n "$ENABLE_TESTS" ]; then
+ return
+ fi
+
+ local src=$(pwd) \
+ stage=
+
+ case $TRAVIS_OS_NAME in
+ linux)
+ stage=$(mktemp -d)
+ ;;
+ osx)
+ stage=$(mktemp -d -t tmp)
+ ;;
+ esac
+
+ test -f Cargo.lock || cargo generate-lockfile
+
+ cross rustc --bin $CRATE_NAME --target $TARGET --release -- -C lto
+
+ strip target/$TARGET/release/$CRATE_NAME
+ cp target/$TARGET/release/$CRATE_NAME $stage/
+
+ cd $stage
+ tar czf $src/$CRATE_NAME-$TRAVIS_TAG-$TARGET.tar.gz *
+ cd $src
+
+ rm -rf $stage
+}
+
+main