From 3e733dee1349734fa712ba2d626b7ab9dc17222d Mon Sep 17 00:00:00 2001
From: Tim Kreuzer <t.kreuzer@fz-juelich.de>
Date: Tue, 23 Apr 2024 20:41:36 +0200
Subject: [PATCH] support post versions for releases

---
 .gitlab-ci.yml | 8 ++++----
 pyproject.toml | 1 +
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index adca87a..b15db22 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -17,7 +17,7 @@ pypi:
     - python -m build
     - twine upload -u __token__ -p ${PYPI_JUPYTERJSC_TOKEN} dist/*
   rules:
-    - if: '$CI_COMMIT_TAG =~ /^\d+\.\d+\.\d+$/'
+    - if: '$CI_COMMIT_TAG =~ /^\d+\.\d+\.\d+(\.post\d+)?$/'
 
 testpypi:
   stage: release
@@ -29,7 +29,7 @@ testpypi:
     - python -m build
     - twine upload --repository testpypi -u __token__ -p ${TESTPYPI_JUPYTERJSC_TOKEN} dist/*
   rules:
-    - if: '$CI_COMMIT_TAG =~ /^\d+\.\d+\.\d+(\..+)$/'
+    - if: '$CI_COMMIT_TAG !~ /^\d+\.\d+\.\d+(\.post\d+)?$/'
 
 
 ###
@@ -42,7 +42,7 @@ prepare_job:
   stage: prepare-release
   image: alpine:latest
   rules:
-  - if: '$CI_COMMIT_TAG =~ /^\d+\.\d+\.\d+$/'
+    - if: '$CI_COMMIT_TAG =~ /^\d+\.\d+\.\d+(\.post\d+)?$/'
   script:
     - apk add curl jq
     - 'curl -H "PRIVATE-TOKEN: $CI_API_TOKEN" "$CI_API_V4_URL/projects/$CI_PROJECT_ID/repository/changelog?version=$CI_COMMIT_TAG" | jq -r .notes > release_notes.md'
@@ -64,7 +64,7 @@ release_job:
     - job: prepare_job
       artifacts: true
   rules:
-  - if: '$CI_COMMIT_TAG =~ /^\d+\.\d+\.\d+$/'
+    - if: '$CI_COMMIT_TAG =~ /^\d+\.\d+\.\d+(\.post\d+)?$/'
   script:
     - echo "Creating release"
   release:
diff --git a/pyproject.toml b/pyproject.toml
index 3dd659d..b96178d 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -59,6 +59,7 @@ regex = '''
   (?P<patch>\d+)
   (?P<pre>((a|b|rc)\d+)|)
   \.?
+  (?P<post>((post)\d+)|)
   (?P<dev>(?<=\.)dev\d*|)
 '''
 
-- 
GitLab