Auto deploy Noms JS SDK (#1208)

This computes a new version based on the number of changes to the
js directory.

This does not yet actually publish the new version. I need to see how
Travis behaves before I can do that.

Towards #1200
This commit is contained in:
Erik Arvidsson
2016-04-11 16:28:32 -07:00
parent 1b7cf1d2bb
commit af72024d35
2 changed files with 25 additions and 0 deletions
+5
View File
@@ -53,3 +53,8 @@ cache:
- clients/pitchmap/ui/node_modules
- clients/splore/node_modules
- nomdl/codegen/test/node_modules
deploy:
provider: script
script: tools/publish-js-sdk.py
on:
branch: master
+20
View File
@@ -0,0 +1,20 @@
#!/usr/bin/python
import os, subprocess
def main():
os.chdir('js')
print os.getcwd()
current_deployed_version = subprocess.check_output(['npm', 'info', '@attic/noms', 'version'])
current_deployed_major_version = current_deployed_version.split('.')[0]
log = subprocess.check_output(['git', 'log', '--oneline', '--', '.'])
new_major_version = len(log.splitlines())
print 'Old version: %s, New version: %s', (current_deployed_version, new_major_version)
if int(new_major_version) > int(current_deployed_major_version):
subprocess.check_call(['npm', 'version', '%s.0.0' % new_major_version])
# subprocess.check_call(['npm', 'publish'])
subprocess.check_call(['npm', 'whomai'])
print 'Not pushing this time. Maybe next time?'
if __name__ == '__main__':
main()