From 5ec5914ced63e09ddeb0c9998c7f7b0c53b80633 Mon Sep 17 00:00:00 2001 From: James Barnsley Date: Wed, 20 Sep 2017 08:40:59 +1200 Subject: [PATCH] Automating releases and version codes to be added automatically via npm task --- build.sh | 17 ++++++++++++++--- mopidy_iris/__init__.py | 2 +- package.json | 5 +++-- src/index.html | 27 +++++++++++++++++++-------- src/js/components/ContextMenu.js | 2 +- 5 files changed, 38 insertions(+), 15 deletions(-) diff --git a/build.sh b/build.sh index 14156834..1980ec60 100755 --- a/build.sh +++ b/build.sh @@ -9,8 +9,19 @@ echo -e Copying index.html cp src/index.html mopidy_iris/static/index.html # process production html -BUILD_NAME=$(date +%s) -echo -e "Injecting build name to js/css URLs ($BUILD_NAME)" -sed -i 's/BUILD_NAME_HERE/'$BUILD_NAME'/g' mopidy_iris/static/index.html +BUILD=$(date +%s) +if [ $# -eq 0 ]; then + VERSION="preview" +else + VERSION=$1 +fi + +echo -e "Injecting build details to js/css URLs (version=$VERSION, build=$BUILD)" +sed -i 's/VERSION_HERE/'$VERSION'/g' mopidy_iris/static/index.html +sed -i 's/BUILD_HERE/'$BUILD'/g' mopidy_iris/static/index.html + +echo -e "Injecting version to static files" +sed -i '/__version__ = "/c\__version__ = "'$VERSION'"' mopidy_iris/__init__.py +sed -i '/ "version": "/c\ "version": "'$VERSION'",' package.json echo -e "\x1b[32;01m"Done!"\x1b[39;49;00m" \ No newline at end of file diff --git a/mopidy_iris/__init__.py b/mopidy_iris/__init__.py index deefe1a4..a81843d3 100755 --- a/mopidy_iris/__init__.py +++ b/mopidy_iris/__init__.py @@ -12,7 +12,7 @@ from handlers import WebsocketHandler, HttpHandler from core import IrisCore logger = logging.getLogger(__name__) -__version__ = '3.4.3' +__version__ = "33" ## # Core extension class diff --git a/package.json b/package.json index bb12c723..0d17db18 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mopidy-iris", - "version": "3.1.1", + "version": "33", "description": "Mopidy HTTP interface", "repository": "https://github.com/jaedb/iris", "author": "James Barnsley ", @@ -43,6 +43,7 @@ "scripts": { "dev": "./build.sh && NODE_ENV=development webpack --watch", "prod": "./build.sh && NODE_ENV=development webpack && NODE_ENV=production webpack", - "release": "NODE_ENV=production webpack && NODE_ENV=development webpack && ./build.sh && python setup.py sdist upload -r pypi" + "test": "./build.sh $1", + "release": "NODE_ENV=production webpack && NODE_ENV=development webpack && ./build.sh $1 && git add -A && git commit -m 'Buildout for version $1' && python setup.py sdist upload -r pypi" } } diff --git a/src/index.html b/src/index.html index fb1a0fcf..582d7db4 100755 --- a/src/index.html +++ b/src/index.html @@ -38,29 +38,40 @@ diff --git a/src/js/components/ContextMenu.js b/src/js/components/ContextMenu.js index 20c1e673..0f5144cb 100755 --- a/src/js/components/ContextMenu.js +++ b/src/js/components/ContextMenu.js @@ -519,7 +519,7 @@ class ContextMenu extends React.Component{ return (
{context.source == 'spotify' ? play_artist_top_tracks : null} - {start_radio} + {context.source == 'spotify' ? start_radio : null} {context.source == 'spotify' ? go_to_recommendations : null} {copy_uris} {this.canBeInLibrary() ? toggle_in_library : null}