mirror of
https://github.com/librespot-org/librespot.git
synced 2024-11-08 16:45:43 +00:00
Add skip-merge and dry-run options to publish script. Update Cargo.lock.
This commit is contained in:
parent
a173fa7cc5
commit
4e0f5e46a5
2 changed files with 109 additions and 17 deletions
6
Cargo.lock
generated
6
Cargo.lock
generated
|
@ -970,7 +970,7 @@ dependencies = [
|
|||
"futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lewton 0.9.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"librespot-core 0.1.3",
|
||||
"librespot-tremor 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"librespot-tremor 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-bigint 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-traits 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1091,7 +1091,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "librespot-tremor"
|
||||
version = "0.1.0"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cc 1.0.58 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -2627,7 +2627,7 @@ dependencies = [
|
|||
"checksum libm 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c7d73b3f436185384286bd8098d17ec07c9a7d2388a6599f824d8502b529702a"
|
||||
"checksum libmdns 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "966e0f9cc15be41e9dbfcd74fd9c04cf69d3c0ec43fc56aa28f5e4da4e545c38"
|
||||
"checksum libpulse-sys 0.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9bb11b06faf883500c1b625cf4453e6c7737e9df9c7ba01df3f84b22b083e4ac"
|
||||
"checksum librespot-tremor 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b155a7dc4e4d272e01c37a1b85c1ee1bee7f04980ad4a7784c1a6e0f2de5929b"
|
||||
"checksum librespot-tremor 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "97f525bff915d478a76940a7b988e5ea34911ba7280c97bd3a7673f54d68b4fe"
|
||||
"checksum linear-map 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bfae20f6b19ad527b550c223fddc3077a547fc70cda94b9b566575423fd303ee"
|
||||
"checksum lock_api 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75"
|
||||
"checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b"
|
||||
|
|
92
publish.sh
92
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 {
|
||||
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
|
||||
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 {
|
||||
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 {
|
||||
|
@ -73,9 +92,18 @@ function publishCrates {
|
|||
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
|
||||
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
|
||||
done
|
||||
|
@ -83,10 +111,32 @@ function publishCrates {
|
|||
|
||||
function updateRepo {
|
||||
cd $WORKINGDIR
|
||||
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 run {
|
||||
|
@ -98,5 +148,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 <args> <version>"
|
||||
echo " where <version> 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
|
||||
|
|
Loading…
Reference in a new issue