forked from ladybug-tools/ladybug
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(deploy): use javascript semantic-release package for deployment
Using the "pure" javascript implementation of semantic-release makes it a bit more flexible to set up custom scripts to run at different stages of the semantic release process. The packages used as well as scripts to run at different stages are specified in the .releaserc.json file. In this case we use standard semantic-release and add a custom deploy script on top of the normal github release setup. The custom deploy script is the new 'deploy.sh' file which takes the new version number as an argument to deploy the package to PyPi and build the documentation. ladybug-tools#125 build(pytest): add pytest-cov deps to dev-requirements.txt build(euclid): add euclid to dev-requirements.txt
- Loading branch information
1 parent
3beb29b
commit 3361688
Showing
8 changed files
with
92 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}" | ||
}] | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 "[email protected]" | ||
- 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 [email protected] | ||
language: node_js | ||
node_js: | ||
- '8' | ||
install: | ||
- pip install -r dev-requirements.txt | ||
- npm install @semantic-release/exec | ||
script: | ||
- git config --global user.email "[email protected]" | ||
- 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/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,37 @@ | ||
atomicwrites==1.2.1 | ||
attrs==18.2.0 | ||
certifi==2018.11.29 | ||
alabaster==0.7.12 | ||
atomicwrites==1.3.0 | ||
attrs==19.1.0 | ||
Babel==2.6.0 | ||
bleach==3.1.0 | ||
certifi==2019.3.9 | ||
chardet==3.0.4 | ||
coverage==4.5.2 | ||
coveralls==1.5.1 | ||
docopt==0.6.2 | ||
coverage==4.5.3 | ||
docutils==0.14 | ||
euclid3==0.1 | ||
idna==2.8 | ||
more-itertools==5.0.0 | ||
pluggy==0.8.0 | ||
py==1.7.0 | ||
pytest==4.1.0 | ||
imagesize==1.1.0 | ||
Jinja2==2.10 | ||
MarkupSafe==1.1.1 | ||
more-itertools==6.0.0 | ||
packaging==19.0 | ||
pkginfo==1.5.0.1 | ||
pluggy==0.9.0 | ||
py==1.8.0 | ||
Pygments==2.3.1 | ||
pyparsing==2.3.1 | ||
pytest==4.3.1 | ||
pytest-cov==2.6.1 | ||
pytz==2018.9 | ||
readme-renderer==24.0 | ||
requests==2.21.0 | ||
requests-toolbelt==0.9.1 | ||
six==1.12.0 | ||
snowballstemmer==1.2.1 | ||
Sphinx==1.8.5 | ||
sphinx-bootstrap-theme==0.6.5 | ||
sphinxcontrib-fulltoc==1.2.0 | ||
sphinxcontrib-websupport==1.1.0 | ||
tqdm==4.31.1 | ||
twine==1.13.0 | ||
urllib3==1.24.1 | ||
webencodings==0.5.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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="[email protected]", | ||
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' | ||
], | ||
|