CI: Always use the latest artifact, not the first one in a dep chain

Change-Id: I77ab6c35e4247a74d70526e1aced8121b7e2105f
diff --git a/ci/build.sh b/ci/build.sh
index 5438b0a..5220740 100755
--- a/ci/build.sh
+++ b/ci/build.sh
@@ -49,9 +49,9 @@
 
 ARTIFACT_URL=""
 
-if [[ "$(jq < ~/zuul-env.json -r '.artifacts[0].project')" = "CzechLight/dependencies" &&
-      "$(jq < ~/zuul-env.json -r '.artifacts[0].name')" = "tarball" ]]; then
-    ARTIFACT_URL=$(jq < ~/zuul-env.json -r '.artifacts[0].url')
+if [[ "$(jq < ~/zuul-env.json -r '.artifacts[-1].project')" = "CzechLight/dependencies" &&
+      "$(jq < ~/zuul-env.json -r '.artifacts[-1].name')" = "tarball" ]]; then
+    ARTIFACT_URL=$(jq < ~/zuul-env.json -r '.artifacts[-1].url')
 fi
 
 DEP_SUBMODULE_COMMIT=$(git ls-tree -l master submodules/dependencies | cut -d ' ' -f 3)