From 8f5ff50aaf8fe21b59e33d5069d617e8e5107327 Mon Sep 17 00:00:00 2001 From: Oscar Krause Date: Tue, 27 Dec 2022 13:34:21 +0100 Subject: [PATCH] .gitlab-ci.yml - dynamically create repo for codename if not exist --- .gitlab-ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5b9c2b1..8efda48 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -121,7 +121,8 @@ deploy:debian: - apt-get update -qq && apt-get install -qq -y curl lsb-release # create distribution initial - CODENAME=`lsb_release -cs` - - 'curl --request POST --header "JOB-TOKEN: $CI_JOB_TOKEN" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/debian_distributions?codename=${CODENAME}"' + # create repo if not exists + - 'if [ "`curl -s -o /dev/null -w "%{http_code}" --header "JOB-TOKEN: $CI_JOB_TOKEN" -s ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/debian_distributions/${CODENAME}/key.asc`" != "200" ]; then curl --request POST --header "JOB-TOKEN: $CI_JOB_TOKEN" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/debian_distributions?codename=${CODENAME}"; fi' script: # Naming format: _-_.deb # Version is the version number of the app being packaged