# HG changeset patch
# User Dan Villiom Podlaski Christiansen <danchr@gmail.com>
# Date 1620906541 -7200
#      Thu May 13 13:49:01 2021 +0200
# Node ID 24c32a1d06676b0e6141f49d1c483500569679d5
# Parent  ec8fefc3adde1c69796272bc41ca4ca51d356c70
ci: build archives on protected branches and when requested

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -232,8 +232,13 @@
   image: quay.io/pypa/${PLATFORM}
   timeout: 15m
   stage: archives
-  only:
-    - tags
+  rules:
+    # run on tags
+    - if: $CI_COMMIT_TAG
+    # run on protected references
+    - if: '$CI_COMMIT_REF_PROTECTED == "true"'
+    # and when explicitly requested
+    - if: '$CI_BUILD_ARCHIVES == "1"'
   variables:
     PYPI_REPOSITORY: ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi
   script: