Fix publish script on Linux

This commit is contained in:
Roderick van Domburg 2022-07-29 22:01:22 +02:00
parent 38bebc242a
commit 91c06efda3
No known key found for this signature in database
GPG key ID: 87F5FDE8A56219F4

View file

@ -8,6 +8,17 @@ cd $WORKINGDIR
crates=( "protocol" "core" "discovery" "audio" "metadata" "playback" "connect" "librespot" ) crates=( "protocol" "core" "discovery" "audio" "metadata" "playback" "connect" "librespot" )
OS=`uname`
function replace_in_file() {
if [ "$OS" == 'darwin' ]; then
# for MacOS
sed -i '' -e "$1" "$2"
else
# for Linux and Windows
sed -i'' -e "$1" "$2"
fi
}
function switchBranch { function switchBranch {
if [ "$SKIP_MERGE" = 'false' ] ; then if [ "$SKIP_MERGE" = 'false' ] ; then
# You are expected to have committed/stashed your changes before running this. # You are expected to have committed/stashed your changes before running this.
@ -33,7 +44,7 @@ function updateVersion {
fi fi
crate_path="$WORKINGDIR/$CRATE_DIR/Cargo.toml" crate_path="$WORKINGDIR/$CRATE_DIR/Cargo.toml"
crate_path=${crate_path//\/\///} crate_path=${crate_path//\/\///}
sed -i '' "s/^version.*/version = \"$1\"/g" "$crate_path" $(replace_in_file "s/^version.*/version = \"$1\"/g" "$crate_path")
echo "Path is $crate_path" echo "Path is $crate_path"
if [ "$CRATE" = "librespot" ] if [ "$CRATE" = "librespot" ]
then then