bundlewrap/bundles/riot-web/items.py

49 lines
1 KiB
Python

assert node.has_bundle('nodejs')
from json import dumps
riot_web_root = '/var/www/{}'.format(node.metadata['riot-web']['url'])
directories = {
riot_web_root: {}
}
git_deploy = {
riot_web_root: {
'needs': {
'directory:' + riot_web_root,
},
'rev': 'master',
'repo': 'https://github.com/vector-im/riot-web.git',
'triggers': {
'action:riot_yarn_install',
'action:riot_yarn_build',
},
},
}
files = {
riot_web_root + '/webapp/config.json': {
'content': dumps(node.metadata['riot-web']['config']),
'needs': {
'action:riot_yarn_build',
},
},
}
actions = {
'riot_yarn_install': {
'command': 'cd ' + riot_web_root + ' && yarn install',
'needs': {
'pkg_apt:yarn',
},
'triggered': True,
},
'riot_yarn_build': {
'command': 'cd ' + riot_web_root + ' && yarn build',
'needs': {
'action:riot_yarn_install',
},
'triggered': True,
},
}