diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 78b447a1fb72b4425e20c8c3e1cbb91b894b753b..10399fd3d299ae90d2c0f0c4b4ece6592c3c1769 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,8 +7,8 @@ stages: - release variables: - PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip" - PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic" + PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip" + PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic" all_tests: stage: test @@ -105,4 +105,17 @@ release_job: - name: "wahlfang-${CI_COMMIT_TAG}.tar.gz" url: "${PACKAGE_REGISTRY_URL}/${CI_COMMIT_TAG}/wahlfang.tar.gz" -# TODO: automatically push to pypi.org when generating a release \ No newline at end of file +publish_job: + stage: release + needs: + - job: package + artifacts: true + rules: + - if: $CI_COMMIT_TAG # only run when we publish a new tag + before_script: + - pip3 install virtualenv + - virtualenv -q .venv + - source .venv/bin/activate + - pip install -U twine + script: + - python -m twine upload dist/* \ No newline at end of file diff --git a/README.md b/README.md index e94e86be2c67004f5fcaa480e7dc6dbad1ab802f..56b6396eb3d049a7ca26f9a74b5f57901805593e 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,14 @@ $ python3 wahlfang/manage.py migrate ``` Don't forget to add the new migration file to git. If the CI pipeline fails this is most likely the reason for it. +## Releasing +The release process is automated in the gitlab ci. + +To make a new release bump the package version number in `wahlfang.__init__.py` and tag the commit with the same version +number. The CI will then build the package, publish it as a gitlab release and push it to pypi. + +The pypi credentials must be set in the gitlab CI settings via the env variables `TWINE_USERNAME` and `TWINE_PASSWORD`. + ## Development References - Django 3: https://docs.djangoproject.com/en/3.2/ diff --git a/wahlfang/__init__.py b/wahlfang/__init__.py index cd7ca4980cf264061d65f39e973230b6c27bc5fd..a6221b3de7b1490c5e712e8b5fcc94c3d9d04295 100644 --- a/wahlfang/__init__.py +++ b/wahlfang/__init__.py @@ -1 +1 @@ -__version__ = '1.0.1' +__version__ = '1.0.2'