Commit 497867cc authored by Pierre Smeyers's avatar Pierre Smeyers
Browse files

fix: sort version tags

parent f75016e5
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -55,7 +55,7 @@ function maybe_process_template() {
  project_path=$(echo "$project_json" | jq -r .path_with_namespace)

  # get tags (latest first, oldest last)
  all_tags=$(curl -sSf -H "$AUTH_HEADER" "$API_URL/projects/$project_id/repository/tags?per_page=100" | jq -r '.[].name')
  all_tags=$(curl -sSf -H "$AUTH_HEADER" "$API_URL/projects/$project_id/repository/tags?per_page=100" | jq -r '.[].name' | sort -rV)
  # filter tags matching preferred pattern, or all tags if none matches
  matching_tags=$(echo "$all_tags" | grep -E "$PREF_TAG_PATTERN" || echo "$all_tags")
  tag=$(echo "$matching_tags" | head -n 1)