diff --git a/Cargo.lock b/Cargo.lock index 68c3440a..769b08d5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1391,7 +1391,7 @@ dependencies = [ [[package]] name = "librespot" -version = "0.1.3" +version = "0.1.5" dependencies = [ "base64 0.13.0", "env_logger", @@ -1420,7 +1420,7 @@ dependencies = [ [[package]] name = "librespot-audio" -version = "0.1.3" +version = "0.1.5" dependencies = [ "aes-ctr", "bit-set", @@ -1439,7 +1439,7 @@ dependencies = [ [[package]] name = "librespot-connect" -version = "0.1.3" +version = "0.1.5" dependencies = [ "aes-ctr", "base64 0.13.0", @@ -1466,7 +1466,7 @@ dependencies = [ [[package]] name = "librespot-core" -version = "0.1.3" +version = "0.1.5" dependencies = [ "aes", "base64 0.13.0", @@ -1502,7 +1502,7 @@ dependencies = [ [[package]] name = "librespot-metadata" -version = "0.1.3" +version = "0.1.5" dependencies = [ "byteorder", "futures", @@ -1515,7 +1515,7 @@ dependencies = [ [[package]] name = "librespot-playback" -version = "0.1.3" +version = "0.1.5" dependencies = [ "alsa", "byteorder", @@ -1541,7 +1541,7 @@ dependencies = [ [[package]] name = "librespot-protocol" -version = "0.1.3" +version = "0.1.5" dependencies = [ "glob", "protobuf", diff --git a/Cargo.toml b/Cargo.toml index 884721c3..d2f1111e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "librespot" -version = "0.1.3" +version = "0.1.5" authors = ["Librespot Org"] license = "MIT" description = "An open source client library for Spotify, with support for Spotify Connect" @@ -22,22 +22,22 @@ doc = false [dependencies.librespot-audio] path = "audio" -version = "0.1.3" +version = "0.1.5" [dependencies.librespot-connect] path = "connect" -version = "0.1.3" +version = "0.1.5" [dependencies.librespot-core] path = "core" -version = "0.1.3" +version = "0.1.5" [dependencies.librespot-metadata] path = "metadata" -version = "0.1.3" +version = "0.1.5" [dependencies.librespot-playback] path = "playback" -version = "0.1.3" +version = "0.1.5" [dependencies.librespot-protocol] path = "protocol" -version = "0.1.3" +version = "0.1.5" [dependencies] base64 = "0.13" diff --git a/audio/Cargo.toml b/audio/Cargo.toml index f6d16f61..97bf6540 100644 --- a/audio/Cargo.toml +++ b/audio/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "librespot-audio" -version = "0.1.3" +version = "0.1.5" authors = ["Paul Lietar "] description="The audio fetching and processing logic for librespot" license="MIT" @@ -8,7 +8,7 @@ edition = "2018" [dependencies.librespot-core] path = "../core" -version = "0.1.3" +version = "0.1.5" [dependencies] bit-set = "0.5" diff --git a/connect/Cargo.toml b/connect/Cargo.toml index 8235870a..24e72ddb 100644 --- a/connect/Cargo.toml +++ b/connect/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "librespot-connect" -version = "0.1.3" +version = "0.1.5" authors = ["Paul Lietar "] description = "The discovery and Spotify Connect logic for librespot" license = "MIT" @@ -9,13 +9,13 @@ edition = "2018" [dependencies.librespot-core] path = "../core" -version = "0.1.3" +version = "0.1.5" [dependencies.librespot-playback] path = "../playback" -version = "0.1.3" +version = "0.1.5" [dependencies.librespot-protocol] path = "../protocol" -version = "0.1.3" +version = "0.1.5" [dependencies] base64 = "0.13" diff --git a/core/Cargo.toml b/core/Cargo.toml index 8511878c..ebb4d326 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "librespot-core" -version = "0.1.3" +version = "0.1.5" authors = ["Paul Lietar "] build = "build.rs" description = "The core functionality provided by librespot" @@ -10,7 +10,7 @@ edition = "2018" [dependencies.librespot-protocol] path = "../protocol" -version = "0.1.3" +version = "0.1.5" [dependencies] base64 = "0.13" diff --git a/metadata/Cargo.toml b/metadata/Cargo.toml index 8f3b4c93..b2bf8e1e 100644 --- a/metadata/Cargo.toml +++ b/metadata/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "librespot-metadata" -version = "0.1.3" +version = "0.1.5" authors = ["Paul Lietar "] description = "The metadata logic for librespot" license = "MIT" @@ -16,7 +16,7 @@ log = "0.4" [dependencies.librespot-core] path = "../core" -version = "0.1.3" +version = "0.1.5" [dependencies.librespot-protocol] path = "../protocol" -version = "0.1.3" +version = "0.1.5" diff --git a/playback/Cargo.toml b/playback/Cargo.toml index 2ae93123..46c98d28 100644 --- a/playback/Cargo.toml +++ b/playback/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "librespot-playback" -version = "0.1.3" +version = "0.1.5" authors = ["Sasha Hilton "] description = "The audio playback logic for librespot" license = "MIT" @@ -9,13 +9,13 @@ edition = "2018" [dependencies.librespot-audio] path = "../audio" -version = "0.1.3" +version = "0.1.5" [dependencies.librespot-core] path = "../core" -version = "0.1.3" +version = "0.1.5" [dependencies.librespot-metadata] path = "../metadata" -version = "0.1.3" +version = "0.1.5" [dependencies] futures = "0.1" diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index 35d65934..fe55ec36 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "librespot-protocol" -version = "0.1.3" +version = "0.1.5" authors = ["Paul LiƩtar "] build = "build.rs" description = "The protobuf logic for communicating with Spotify servers" diff --git a/publish.sh b/publish.sh index fb70af3e..478741a5 100755 --- a/publish.sh +++ b/publish.sh @@ -1,16 +1,25 @@ #!/bin/bash +SKIP_MERGE='false' +DRY_RUN='false' + WORKINGDIR="$( cd "$(dirname "$0")" ; pwd -P )" cd $WORKINGDIR crates=( "protocol" "core" "audio" "metadata" "playback" "connect" "librespot" ) function switchBranch { - # You are expected to have committed/stashed your changes before running this. - echo "Switching to master branch and merging development." - git checkout master - git pull - git merge dev + if [ "$SKIP_MERGE" = 'false' ] ; then + # You are expected to have committed/stashed your changes before running this. + echo "Switching to master branch and merging development." + git checkout master + git pull + if [ "$DRY_RUN" = 'true' ] ; then + git merge --no-commit --no-ff dev + else + git merge dev + fi + fi } function updateVersion { @@ -26,15 +35,25 @@ function updateVersion { echo "Path is $crate_path" if [ "$CRATE" = "librespot" ] then - cargo update - git add . && git commit -a -m "Update Cargo.lock" + if [ "$DRY_RUN" = 'true' ] ; then + cargo update --dry-run + git add . && git commit --dry-run -a -m "Update Cargo.lock" + else + cargo update + git add . && git commit -a -m "Update Cargo.lock" + fi fi done } function commitAndTag { - git commit -a -m "Update version numbers to $1" - git tag "v$1" -a -m "Update to version $1" + if [ "$DRY_RUN" = 'true' ] ; then + # Skip tagging on dry run. + git commit --dry-run -a -m "Update version numbers to $1" + else + git commit -a -m "Update version numbers to $1" + git tag "v$1" -a -m "Update to version $1" + fi } function get_crate_name { @@ -72,9 +91,17 @@ function publishCrates { if [ "$CRATE" == "protocol" ] then # Protocol crate needs --no-verify option due to build.rs modification. - cargo publish --no-verify + if [ "$DRY_RUN" = 'true' ] ; then + cargo publish --no-verify --dry-run + else + cargo publish --no-verify + fi else - cargo publish + if [ "$DRY_RUN" = 'true' ] ; then + cargo publish --dry-run + else + cargo publish + fi fi echo "Successfully published $crate_name to crates.io" remoteWait 30 $crate_name @@ -83,10 +110,32 @@ function publishCrates { function updateRepo { cd $WORKINGDIR - echo "Pushing to master branch of repo." - git push origin master - echo "Pushing v$1 tag to master branch of repo." - git push origin v$1 + if [ "$DRY_RUN" = 'true' ] ; then + echo "Pushing to master branch of repo. [DRY RUN]" + git push --dry-run origin master + echo "Pushing v$1 tag to master branch of repo. [DRY RUN]" + git push --dry-run origin v$1 + + # Cancels any merges in progress + git merge --abort + + git checkout dev + git merge --no-commit --no-ff master + + # Cancels above merge + git merge --abort + + git push --dry-run + else + echo "Pushing to master branch of repo." + git push origin master + echo "Pushing v$1 tag to master branch of repo." + git push origin v$1 + # Update the dev repo with latest version commit + git checkout dev + git merge master + git push + fi } function rebaseDev { @@ -105,5 +154,47 @@ function run { echo "Successfully published v$1 to crates.io and uploaded changes to repo." } +#Set Script Name variable +SCRIPT=`basename ${BASH_SOURCE[0]}` + +print_usage () { + local l_MSG=$1 + if [ ! -z "${l_MSG}" ]; then + echo "Usage Error: $l_MSG" + fi + echo "Usage: $SCRIPT " + echo " where specifies the version number in semver format, eg. 1.0.1" + echo "Recognized optional command line arguments" + echo "--dry-run -- Test the script before making live changes" + echo "--skip-merge -- Skip merging dev into master before publishing" + exit 1 +} + +### check number of command line arguments +NUMARGS=$# +if [ $NUMARGS -eq 0 ]; then + print_usage 'No command line arguments specified' +fi + +while test $# -gt 0; do + case "$1" in + -h|--help) + print_usage + exit 0 + ;; + --dry-run) + DRY_RUN='true' + shift + ;; + --skip-merge) + SKIP_MERGE='true' + shift + ;; + *) + break + ;; + esac +done + # First argument is new version number. run $1