Allow to build arbitrary git ref

This commit is contained in:
Greizgh 2019-03-27 09:54:29 +01:00
parent c7f1ca8b72
commit a6b8e89a02

View File

@ -5,15 +5,16 @@ set -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
SRC="$DIR/git" SRC="$DIR/git"
DST="$DIR/dist" DST="$DIR/dist"
if [ -z "$1" ]; then REF="master"; else REF="$1"; fi
# Clone bitwarden_rs # Clone bitwarden_rs
if [ -d "$SRC" ]; then if [ ! -d "$SRC" ]; then
cd "$SRC" || exit
git pull
cd - || exit
else
git clone https://github.com/dani-garcia/bitwarden_rs.git "$SRC" git clone https://github.com/dani-garcia/bitwarden_rs.git "$SRC"
fi fi
cd "$SRC" || exit
git fetch
git checkout "$REF"
cd - || exit
# Prepare EnvFile # Prepare EnvFile
CONFIG="$DIR/debian/config.env" CONFIG="$DIR/debian/config.env"
@ -26,5 +27,5 @@ mkdir -p "$DST"
docker build -t bitwarden-deb "$DIR" docker build -t bitwarden-deb "$DIR"
CID=$(docker run -d bitwarden-deb) CID=$(docker run -d bitwarden-deb)
docker cp "$CID":/bitwarden_package/bitwarden-rs.deb "$DST" docker cp "$CID":/bitwarden_package/bitwarden-rs.deb "$DST/bitwarden_rs-$REF.deb"
docker rm "$CID" docker rm "$CID"