From a332e8d18b2ad047c36e688d0538f424e9466560 Mon Sep 17 00:00:00 2001
From: lewa <lene.wasskog@nibio.no>
Date: Mon, 6 Feb 2023 11:08:51 +0100
Subject: [PATCH] chore: Running deploy stage only for main branch, update doc

---
 .gitlab-ci.yml |  2 +-
 README.md      | 22 +++++++++++-----------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 5aa4438..a74711a 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -36,7 +36,7 @@ test:
 deploy:
     stage: deploy
     only: 
-        - feature/mad-91-gitlab-pipeline
+        - main
     tags:
         - vips-runner
     script:
diff --git a/README.md b/README.md
index 5eab4e4..4564ed0 100644
--- a/README.md
+++ b/README.md
@@ -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`.
-
-- 
GitLab