38 lines
1.1 KiB
Bash
Executable File
38 lines
1.1 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
script/build
|
|
|
|
# Get a fresh directory and make sure to delete it afterwards
|
|
build_dir=tmp/build
|
|
rm -rf $build_dir
|
|
mkdir -p $build_dir
|
|
trap "rm -rf $build_dir" EXIT
|
|
|
|
commit_sha=$(git rev-parse HEAD)
|
|
|
|
if [ $(uname -s) = "Darwin" ]; then
|
|
build_arch="$(uname -sr | tr -d ' ' | tr '[:upper:]' '[:lower:]')-$(uname -m)"
|
|
else
|
|
build_arch="$(lsb_release -sc | tr -d ' ' | tr '[:upper:]' '[:lower:]')-$(uname -m)"
|
|
fi
|
|
|
|
tarball=$build_dir/${commit_sha}-${build_arch}.tar
|
|
|
|
# Create the tarball
|
|
tar cvf $tarball --mode="ugo=rx" bin/
|
|
|
|
# Compress it and copy it to the directory for the CI to upload it
|
|
gzip $tarball
|
|
mkdir -p "$BUILD_ARTIFACT_DIR"/gh-ost
|
|
cp ${tarball}.gz "$BUILD_ARTIFACT_DIR"/gh-ost/
|
|
|
|
### HACK HACK HACK HACK ###
|
|
# blame @carlosmn, @mattr and @timvaillancourt-
|
|
# Allow builds on buster to also be used for streth + jessie
|
|
stretch_tarball_name=$(echo $(basename "${tarball}") | sed s/-buster-/-stretch-/)
|
|
jessie_tarball_name=$(echo $(basename "${tarball}") | sed s/-stretch-/-jessie-/)
|
|
cp ${tarball}.gz "$BUILD_ARTIFACT_DIR/gh-ost/${stretch_tarball_name}.gz"
|
|
cp ${tarball}.gz "$BUILD_ARTIFACT_DIR/gh-ost/${jessie_tarball_name}.gz"
|