Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(deploy): use javascript semantic-release package for deployment #126

Merged
merged 2 commits into from
Mar 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/github",
["@semantic-release/exec", {
"publishCmd": "bash deploy.sh ${nextRelease.version}"
}]
]
}
43 changes: 21 additions & 22 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,24 @@ after_success:

jobs:
include:
- stage: deploy
if: branch = master AND (NOT type IN (pull_request))
python: "3.6"
env: TRAVIS=true
script:
- git config --global user.name "ladybugbot"
- git config --global user.email "release@ladybug.tools"
- pip install python-semantic-release
- semantic-release publish
# generate updated documentation
- pip install Sphinx sphinxcontrib-fulltoc sphinx_bootstrap_theme
- sphinx-apidoc -f -e -d 4 -o ./docs ./ladybug ./ladybug/euclid.py
- sphinx-build -b html ./docs ./docs/_build/docs
# deploy to github pages
# https://docs.travis-ci.com/user/deployment/pages/
provider: pages
skip_cleanup: true
github-token: $GH_TOKEN
keep-history: false
on:
branch: master
local_dir: docs/_build/
- stage: deploy
if: branch = master AND (NOT type IN (pull_request))
before_install:
- npm i -g npm@6.6.0
language: node_js
node_js:
- '8'
install:
- pip install -r dev-requirements.txt
- npm install @semantic-release/exec
script:
- git config --global user.email "releases@ladybug.tools"
- git config --global user.name "ladybugbot"
- npx semantic-release
provider: pages
skip_cleanup: true
github-token: $GH_TOKEN
keep-history: false
on:
branch: master
local_dir: docs/_build/
26 changes: 26 additions & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/sh

deploy_to_pypi() {
echo "Building distribution"
python setup.py sdist bdist_wheel
echo "Pushing new version to PyPi"
twine upload dist/* -u $PYPI_USERNAME -p $PYPI_PASSWORD
}

build_docs() {
echo "Building documentation files"
sphinx-apidoc -f -e -d 4 -o ./docs ./ladybug ./ladybug/euclid.py
sphinx-build -b html ./docs ./docs/_build/docs -D release=$1 -D version=$1
}


if [ -n "$1" ]
then
NEXT_RELEASE_VERSION=$1
else
echo "A release version must be supplied"
exit 1
fi

deploy_to_pypi
build_docs $NEXT_RELEASE_VERSION
22 changes: 7 additions & 15 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
atomicwrites==1.2.1
attrs==18.2.0
certifi==2018.11.29
chardet==3.0.4
coverage==4.5.2
coveralls==1.5.1
docopt==0.6.2
coverage==4.5.3
euclid3==0.1
idna==2.8
more-itertools==5.0.0
pluggy==0.8.0
py==1.7.0
pytest==4.1.0
pytest==4.3.1
pytest-cov==2.6.1
requests==2.21.0
six==1.12.0
urllib3==1.24.1
Sphinx==1.8.5
sphinx-bootstrap-theme==0.6.5
sphinxcontrib-fulltoc==1.2.0
sphinxcontrib-websupport==1.1.0
twine==1.13.0
6 changes: 2 additions & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,11 @@
copyright = '2019, Ladybug Tools'
author = 'Ladybug Tools'

# The short X.Y version
import ladybug
version = ladybug.__version__

# The full version, including alpha/beta/rc tags
release = ''

# for example take major/minor
version = ''

# -- General configuration ---------------------------------------------------

Expand Down
1 change: 0 additions & 1 deletion ladybug/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import importlib
import pkgutil

__version__ = '0.3.0'

# find and import ladybug plugins
# this is a critical step to add additional functionalities to ladybug core library.
Expand Down
3 changes: 0 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[semantic_release]
version_variable = ladybug/__init__.py:__version__

[bdist_wheel]
universal = 1

Expand Down
18 changes: 3 additions & 15 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,17 @@
with open("README.md", "r") as fh:
long_description = fh.read()

with open('ladybug/__init__.py', 'r') as fd:
version = re.search(
r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]',
fd.read(),
re.MULTILINE
).group(1)

try:
from semantic_release import setup_hook
setup_hook(sys.argv)
except ImportError:
pass

setuptools.setup(
name="lbt-ladybug",
version=version,
use_scm_version = True,
setup_requires=['setuptools_scm'],
author="Ladybug Tools",
author_email="info@ladybug.tools",
description="Ladybug is a Python library to load, analyze and modify EneregyPlus Weather files (epw).",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/ladybug-tools/ladybug",
packages=setuptools.find_packages(),
packages=setuptools.find_packages(exclude=["tests"]),
install_requires=[
'euclid3==0.1'
],
Expand Down