From 47a4f77945a336f83492d7fc611a6932b6d9f3ac Mon Sep 17 00:00:00 2001 From: Xuan Hu Date: Wed, 26 Jul 2023 08:50:08 +0000 Subject: [PATCH 1/2] GitLab: Create a release when a new tag created. --- .gitlab-ci.yml | 19 +++++++++++++++---- .vscode/settings.json | 2 ++ 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f7cd068f..dc5e03a4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,8 +1,11 @@ stages: - lint_test - build_release +default: + image: python:3.11 lint: image: python:$PYTHON_VERSION + interruptible: true only: - /^v(?P0|[1-9]\d*)\.(?P0|[1-9]\d*)\.(?P0|[1-9]\d*)$/ - main @@ -27,6 +30,7 @@ tests: path: coverage.xml coverage: /(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/ image: python:$PYTHON_VERSION + interruptible: true only: - /^v(?P0|[1-9]\d*)\.(?P0|[1-9]\d*)\.(?P0|[1-9]\d*)$/ - main @@ -64,12 +68,19 @@ pages: - docs/**/* refs: - /^v(?P0|[1-9]\d*)\.(?P0|[1-9]\d*)\.(?P0|[1-9]\d*)$/ - - main script: - env | sort - make dev-docs - make docs stage: build_release -default: - image: python:3.11 - interruptible: true +release: + release: + description: $CI_COMMIT_TAG_MESSAGE + name: $CI_COMMIT_TAG + tag_name: $CI_COMMIT_TAG + image: registry.gitlab.com/gitlab-org/release-cli:latest + only: + - /^v(?P0|[1-9]\d*)\.(?P0|[1-9]\d*)\.(?P0|[1-9]\d*)$/ + script: + - env | sort + stage: build_release diff --git a/.vscode/settings.json b/.vscode/settings.json index d088ee86..824c2965 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -79,10 +79,12 @@ "minimal_python_version", "maximal_python_version", "stages", + "default", "lint", "tests", "package", "pages", + "release", "3.8", "3.9", "3.10", From 2439100e3bcd5c9993219e874192512c2b80a135 Mon Sep 17 00:00:00 2001 From: Xuan Hu Date: Wed, 26 Jul 2023 10:22:27 +0000 Subject: [PATCH 2/2] Align the template. --- .gitlab-ci.yml.jinja | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml.jinja b/.gitlab-ci.yml.jinja index 8f9bc166..6540c106 100644 --- a/.gitlab-ci.yml.jinja +++ b/.gitlab-ci.yml.jinja @@ -2,8 +2,11 @@ stages: - lint_test - build_release +default: + image: python:3.11 lint: image: python:$PYTHON_VERSION + interruptible: true only: - /^v(?P0|[1-9]\d*)\.(?P0|[1-9]\d*)\.(?P0|[1-9]\d*)$/ - main @@ -36,6 +39,7 @@ tests: path: coverage.xml coverage: /(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/ image: python:$PYTHON_VERSION + interruptible: true only: - /^v(?P0|[1-9]\d*)\.(?P0|[1-9]\d*)\.(?P0|[1-9]\d*)$/ - main @@ -81,12 +85,19 @@ pages: - docs/**/* refs: - /^v(?P0|[1-9]\d*)\.(?P0|[1-9]\d*)\.(?P0|[1-9]\d*)$/ - - main script: - env | sort - make dev-docs - make docs stage: build_release -default: - image: python:{{ default_python_version }} - interruptible: true +release: + release: + description: $CI_COMMIT_TAG_MESSAGE + name: $CI_COMMIT_TAG + tag_name: $CI_COMMIT_TAG + image: registry.gitlab.com/gitlab-org/release-cli:latest + only: + - /^v(?P0|[1-9]\d*)\.(?P0|[1-9]\d*)\.(?P0|[1-9]\d*)$/ + script: + - env | sort + stage: build_release