forked from kovidgoyal/rapydscript-ng
-
Notifications
You must be signed in to change notification settings - Fork 0
/
publish.py
executable file
·36 lines (30 loc) · 1.22 KB
/
publish.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env python
# vim:fileencoding=utf-8
# License: BSD Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
import subprocess
import os
import shutil
import json
# Load metadata
base = os.path.dirname(os.path.abspath(__file__))
subprocess.check_call([os.path.join(base, 'build')])
with open('package.json', 'rb') as f:
m = json.load(f)
version = m['version']
# Update the files in release/ from dev/
shutil.rmtree(os.path.join(base, 'release'))
shutil.copytree(os.path.join(base, 'dev'), os.path.join(base, 'release'))
subprocess.check_call(['git', 'add', os.path.join(base, 'release')])
if subprocess.check_output(
'git status --porcelain --untracked-files release'.split()).strip():
subprocess.check_call([
'git', 'commit', '-m', 'Updating release build of compiler'])
subprocess.check_call('git push'.split())
# Tag the release
subprocess.check_call('git tag -s v{0} -m version-{0}'.format(version).split())
subprocess.check_call(['git', 'push', 'origin', 'v'+version])
# Update the web REPL
gh_pages = os.path.join(os.path.dirname(base), 'kovidgoyal.github.io')
subprocess.check_call([os.path.join(gh_pages, 'update-rapyd-repl.py')])
# Publish to NPM
subprocess.check_call(['npm', 'publish', base])