Add release task
This commit is contained in:
parent
5a584982e4
commit
32cfafc88a
1 changed files with 35 additions and 0 deletions
35
tasks.py
Normal file
35
tasks.py
Normal file
|
@ -0,0 +1,35 @@
|
|||
# -*- 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'")
|
Loading…
Add table
Add a link
Reference in a new issue