diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1bd3624d8b660df2fafd1f10c7d27cfccd82ec66..050d5541e1f65865754f800c8c4e68fb8113784a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -18,7 +18,7 @@ image: registry.duniter.org/docker/python3/duniterpy-builder:0.0.4 GIT_STRATEGY: none tags: - github - script: + after_script: - rm -rf ./* - rm -rf .git - git clone --mirror $CI_REPOSITORY_URL . @@ -49,16 +49,6 @@ image: registry.duniter.org/docker/python3/duniterpy-builder:0.0.4 - setup.py - tests/**/*.py -.release_pip: &release_pip - script: - - pip install twine - - twine upload dist/* --username duniter --password $PYPI_PASSWORD - -.release_pip_test: &release_pip_test - script: - - pip install twine - - twine upload dist/* --username duniter --password $PYPI_PASSWORD --repository-url https://test.pypi.org/legacy/ - # TASKS format: <<: *pyenv @@ -89,26 +79,32 @@ check: - make mypy - make pylint -build: &build +build: <<: *pyenv <<: *changes stage: build script: - pip install -r requirements.txt - - pip install wheel - - python setup.py sdist bdist_wheel + - pip install -r requirements_deploy.txt + - make build releases: <<: *pyenv - <<: *build - <<: *release_pip <<: *push_to_github stage: release when: manual + script: + - pip install -r requirements.txt + - pip install -r requirements_deploy.txt + - make build + - make deploy PYPI_PASSWORD=${PYPI_PASSWORD} release_test: <<: *pyenv - <<: *build - <<: *release_pip_test stage: release - when: manual \ No newline at end of file + when: manual + script: + - pip install -r requirements.txt + - pip install -r requirements_deploy.txt + - make build + - make deploy_test PYPI_PASSWORD=${PYPI_PASSWORD} diff --git a/Makefile b/Makefile index 962854a86123107e129e4533a9dc68f1538eb132..34b25197dd01ef78c21dc0aecc1e95713679aa2e 100644 --- a/Makefile +++ b/Makefile @@ -33,4 +33,16 @@ check-format: format: black duniterpy black tests - black examples \ No newline at end of file + black examples + +# build a whell package in dist folder +build: + python setup.py sdist bdist_wheel + +# upload on PyPi repository +deploy: + twine upload dist/* --username duniter --password ${PYPI_PASSWORD} + +# upload on PyPi test repository +deploy_test: + twine upload dist/* --username duniter --password ${PYPI_PASSWORD} --repository-url https://test.pypi.org/legacy/ diff --git a/README.rst b/README.rst index 2dc5427f58b638bab444e3c9b3a7c9dfc20dffaa..c57b61b39e7788d95ff0c681028c892eec473b09 100644 --- a/README.rst +++ b/README.rst @@ -105,21 +105,23 @@ Packaging and deploy Pypi ++++ -In the development pyenv environment, install the following tools:: +In the development pyenv environment, install the build and deploy tools:: - pip install --upgrade pip setuptools wheel + pip install --upgrade -r requirements_deploy.txt - pip install twine - -Change the version number (semantic version number):: +Change and commit and tag the new version number (semantic version number):: ./release.sh 0.42.3 Build the Pypi package in the ``dist`` folder:: - python setup.py sdist bdist_wheel + make build + +Deploy the package on the Pypi test repository (use a space before make to not keep command with password in shell history):: + + [SPACE]make deploy_test PYPI_PASSWORD=xxxx -Deploy the package on the Pypi repository:: +Deploy the package on the Pypi repository (use a space before make to not keep command with password in shell history):: - twine upload dist/* + [SPACE]make deploy PYPI_PASSWORD=xxxx diff --git a/requirements_deploy.txt b/requirements_deploy.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba996edcec3893f32b1aa660f95dc62a1ca4d249 --- /dev/null +++ b/requirements_deploy.txt @@ -0,0 +1,3 @@ +setuptools +wheel +twine \ No newline at end of file