ci: move deploy-stage later in the pipeline
[mesa.git] / .gitlab-ci.yml
index 04fbe6c00518cceca4250cca5cb776fcf3be140e..b22e3423b45b73b510ee24a120940afd2486975b 100644 (file)
@@ -9,7 +9,6 @@ include:
   - local: '.gitlab-ci/test-source-dep.yml'
 
 stages:
-  - deploy
   - container
   - container-2
   - meson-x86_64
@@ -22,20 +21,38 @@ stages:
   - radv
   - lima
   - virgl
+  - deploy
   - success
 
-pages:
+.docs-base:
   image: alpine
   stage: deploy
   script:
   - apk --no-cache add py3-pip
   - pip3 install sphinx sphinx_rtd_theme
   - sphinx-build -b html docs public
+
+pages:
+  extends: .docs-base
   artifacts:
     paths:
     - public
   only:
-  - master
+    refs:
+    - master@mesa/mesa
+    changes:
+    - docs/**/*
+    - .gitlab-ci.yml
+
+test-docs:
+  extends: .docs-base
+  except:
+    refs:
+    - master@mesa/mesa
+  only:
+    changes:
+    - docs/**/*
+    - .gitlab-ci.yml
 
 # When to automatically run the CI
 .ci-run-policy:
@@ -118,20 +135,27 @@ success:
   extends:
     - .ci-run-policy
   rules:
+    # Run pipeline by default in the main project if any CI pipeline
+    # configuration files were changed, to ensure docker images are up to date
+    - if: '$CI_PROJECT_PATH == "mesa/mesa"'
+      changes:
+      - .gitlab-ci.yml
+      - .gitlab-ci/**/*
+      when: on_success
     # Run pipeline by default if it was triggered by Marge Bot, is for a
-    # merge request, and any files affecting it were changed
-    - if: '$GITLAB_USER_LOGIN == "marge-bot" && $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME == $CI_COMMIT_REF_NAME'
+    # merge request, and any files affecting the pipeline were changed
+    - if: '$GITLAB_USER_LOGIN == "marge-bot" && $CI_PROJECT_PATH != "mesa/mesa"'
       changes:
         *all_paths
       when: on_success
-    # Run pipeline by default in the main project if any files affecting it were
-    # changed
-    - if: '$CI_PROJECT_PATH == "mesa/mesa"'
+    # Run pipeline by default in the main project if it was not triggered by
+    # Marge Bot, and any files affecting the pipeline were changed
+    - if: '$GITLAB_USER_LOGIN != "marge-bot" && $CI_PROJECT_PATH == "mesa/mesa"'
       changes:
         *all_paths
       when: on_success
-    # Allow triggering jobs manually for MRs or branches of forked projects if
-    # any files affecting the pipeline were changed
+    # Allow triggering jobs manually in other cases if any files affecting the
+    # pipeline were changed
     - changes:
         *all_paths
       when: manual