35 lines
828 B
Python
35 lines
828 B
Python
# -*- coding: utf-8; -*-
|
|
"""
|
|
Tasks for myweather
|
|
"""
|
|
|
|
import os
|
|
import json
|
|
|
|
from invoke import task
|
|
|
|
|
|
here = os.path.dirname(__file__)
|
|
|
|
|
|
@task
|
|
def release(c):
|
|
"""
|
|
Release a new version of myweather
|
|
"""
|
|
# figure out current package version
|
|
package_json = os.path.join(here, 'package.json')
|
|
with open(package_json, 'rt') as f:
|
|
js = json.load(f)
|
|
version = js['version']
|
|
|
|
# build the app, create zip archive
|
|
c.run('npm run build')
|
|
os.chdir('dist')
|
|
filename = f'myweather-{version}.zip'
|
|
c.run(f'zip --recurse-paths {filename} *')
|
|
os.chdir(os.pardir)
|
|
|
|
# upload zip archive to server
|
|
c.run(f'scp dist/{filename} weather.edbob.org:/srv/myweather/releases/{filename}')
|
|
c.run(f"ssh weather.edbob.org 'cd /srv/myweather/releases; ln -sf {filename} latest.zip'")
|