Automating releases and version codes to be added automatically via npm task

This commit is contained in:
James Barnsley
2017-09-20 08:40:59 +12:00
parent 6e1bb6838e
commit 5ec5914ced
5 changed files with 38 additions and 15 deletions

View File

@ -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"

View File

@ -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

View File

@ -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 <james@barnsley.nz>",
@ -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"
}
}

View File

@ -38,29 +38,40 @@
<script type="text/javascript">
var build = "BUILD_HERE";
var version = "VERSION_HERE";
// Initiate Raven Sentry
Raven.config('https://023e3bf7721b48f29948545fc36a4621@sentry.io/219026').install()
var build_name = "BUILD_NAME_HERE";
Raven.config(
'https://023e3bf7721b48f29948545fc36a4621@sentry.io/219026',
{
release: version+"_"+build
}
).install();
// Construct the script tag
var js = document.createElement("script");
js.type = "application/javascript";
// Construct our css tag
var css = document.createElement("link");
css.rel = "stylesheet";
// Identify whether we're in test mode, and need to fetch non-minified assets
var ui = JSON.parse( localStorage.getItem('ui') );
if (typeof(ui) === 'undefined' || !ui || typeof(ui.test_mode) === 'undefined' || !ui.test_mode){
js.src = '/iris/app.min.js?v='+build_name;
css.href = '/iris/app.min.css?v='+build_name;
js.src = '/iris/app.min.js?v='+build;
css.href = '/iris/app.min.css?v='+build;
} else {
js.src = '/iris/app.js?v='+build_name;
css.href = '/iris/app.css?v='+build_name;
js.src = '/iris/app.js?v='+build;
css.href = '/iris/app.css?v='+build;
}
// And finally inject our CSS/JS tags
document.body.appendChild(js);
document.body.appendChild(css);
</script>
</html>

View File

@ -519,7 +519,7 @@ class ContextMenu extends React.Component{
return (
<div>
{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}