diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 6b2a7fdc58e2e9345e000b469c65fc6616343790..6457a5e8a7052ad2bfcdaa61aa3cf0f5a54edae8 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -82,11 +82,15 @@ system-tests:
       CI_COMMIT_BRANCH="$CI_COMMIT_BRANCH" \
       ./ci-tools/update-grid-servers "${PRIVATESTORAGEIO_SSH_DEPLOY_KEY_PATH}" "${CI_ENVIRONMENT_NAME}"
 
-# Update the staging deployment - only on a merge to the staging branch.
+# Update the staging deployment - only on a commit to the staging branch.
 update-staging:
   <<: *UPDATE_GRID
-  only:
-    - "staging"
+  # https://docs.gitlab.com/ee/ci/yaml/#rules
+  rules:
+    # https://docs.gitlab.com/ee/ci/yaml/index.html#rulesif
+    # https://docs.gitlab.com/ee/ci/jobs/job_control.html#cicd-variable-expressions
+    # https://docs.gitlab.com/ee/ci/variables/predefined_variables.html
+    - if: '$CI_COMMIT_BRANCH == "staging"'
   environment:
     # You can find some status information about environments in GitLab at
     # https://whetstone.privatestorage.io/privatestorage/PrivateStorageio/-/environments.
@@ -100,11 +104,16 @@ update-staging:
     # button...  Still, discoverability or something.
     url: "https://monitoring.privatestorage-staging.com/"
 
-# Update the production deployment - only on a merge to the production branch.
+# Update the production deployment - only on a commit to the production branch.
 deploy-to-production:
   <<: *UPDATE_GRID
-  only:
-    - "production"
+  # https://docs.gitlab.com/ee/ci/yaml/#rules
+  rules:
+    # https://docs.gitlab.com/ee/ci/yaml/index.html#rulesif
+    # https://docs.gitlab.com/ee/ci/jobs/job_control.html#cicd-variable-expressions
+    # https://docs.gitlab.com/ee/ci/variables/predefined_variables.html
+    - if: '$CI_COMMIT_BRANCH == "production"'
+
   environment:
     # See notes in `update-staging`.
     name: "production"