Skip to content
Snippets Groups Projects
Commit a332e8d1 authored by Lene Wasskog's avatar Lene Wasskog
Browse files

chore: Running deploy stage only for main branch, update doc

parent fb47830d
Branches
No related tags found
1 merge request!1Feature/mad 91 gitlab pipeline
Pipeline #699 passed
......@@ -36,7 +36,7 @@ test:
deploy:
stage: deploy
only:
- feature/mad-91-gitlab-pipeline
- main
tags:
- vips-runner
script:
......
......@@ -46,14 +46,17 @@ bumpver update --major
### References
We used this excellent guide for packaging: https://realpython.com/pypi-publish-python-package/
### Manual deployment
### Deployment
Temporary notes of steps required for building and uploading package
Whenever changes are pushed to the repository, the pipeline defined in `.gitlab-ci.yml` is triggered. Here, there are three jobs: build, test and deploy.
The final job will only be performed for the `main` branch. Please note that publishing a package to the package repository will fail (= red deploy job)
if the version of the package has not been bumped since the previous deploy.
Create [Personal access token](https://gitlab.nibio.no/-/profile/personal_access_tokens) with name=`gitlab-pypi` and scope=`Api`.
Follow these steps for running build, test + deploy on your laptop:
Create file `~/.pypirc` with the following content:
1. Create [Personal access token](https://gitlab.nibio.no/-/profile/personal_access_tokens) with name=`gitlab-pypi` and scope=`Api`.
2. Create file `~/.pypirc` with the following content:
```
[distutils]
index-servers =
......@@ -65,24 +68,21 @@ username = gitlab-pypi
password = <personal access token>
```
Clone project, build and deploy package
3. Clone project, build, test and deploy package
```
$ git clone git@gitlab.nibio.no:VIPS/vipscore-python-common.git
$ cd vipscore-python-common
$ python3 -m venv venv
$ . venv/bin/activate
$ pip install -e .
$ pip install build pytest twine
$ python3 -m build
-> Successfully built vipscore_common-0.1.6.tar.gz and vipscore_common-0.1.6-py3-none-any.whl
$ pytest
-> [100%] ======================= 2 passed in 0.27s ==========================
$ python3 -m twine upload --repository gitlab dist/* --verbose
-> Uploading vipscore_common-0.1.6-py3-none-any.whl
-> 201 Created
-> Uploading vipscore_common-0.1.6.tar.gz
-> 201 Created
```
### Pipeline deployment
See pipeline configuration in `.gitlab-ci.yml`.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment