forked from Mirrors/humblebundle-downloader
Added ci for releasing new versions to pypi
This commit is contained in:
37
.gitlab-ci.yml
Normal file
37
.gitlab-ci.yml
Normal file
@@ -0,0 +1,37 @@
|
||||
image: python:3
|
||||
|
||||
stages:
|
||||
- test
|
||||
- release
|
||||
|
||||
flake8:
|
||||
stage: test
|
||||
script:
|
||||
- pip install tox
|
||||
- tox -e flake8
|
||||
|
||||
release-package:
|
||||
stage: release
|
||||
only:
|
||||
- master
|
||||
script:
|
||||
- pip install twine
|
||||
- rm -f dist/*
|
||||
- python setup.py sdist
|
||||
- twine upload -u ${PYPI_USER} -p ${PYPI_PASS} dist/*
|
||||
|
||||
|
||||
.write_permission: &write_permission |
|
||||
git config --global user.email "gitlab-ci"; git config --global user.name "gitlab-ci"
|
||||
url_host=`git remote get-url origin | sed -e "s/https:\/\/gitlab-ci-token:.*@//g"`
|
||||
git remote set-url origin "https://gitlab-ci-token:${CI_TAG_UPLOAD_TOKEN}@${url_host}"
|
||||
|
||||
tag:
|
||||
stage: release
|
||||
only:
|
||||
- master
|
||||
script:
|
||||
- *write_permission
|
||||
- export VERSION=$(echo $(python -c "import _version; print(_version.__version__)"))
|
||||
- git tag -a $VERSION -m "Version created by gitlab-ci Build"
|
||||
- git push origin $VERSION
|
||||
Reference in New Issue
Block a user