Update .gitea/workflows/deploy-ci.yaml
Some checks failed
Update Community Skins README / Full CI/CD Pipeline (push) Failing after 0s
Some checks failed
Update Community Skins README / Full CI/CD Pipeline (push) Failing after 0s
This commit is contained in:
@@ -51,31 +51,14 @@ jobs:
|
||||
owner=$(echo "$repos_json" | jq -r ".[$j].owner.login")
|
||||
repo=$(echo "$repos_json" | jq -r ".[$j].name")
|
||||
|
||||
echo "DEBUG: Fetching README for $owner/$repo"
|
||||
readme_json=$(curl -sSL -H "Authorization: token $TOKEN" \
|
||||
"$GITEA_API/repos/$owner/$repo/contents/README.md?ref=main" || echo "{}")
|
||||
content=$(echo "$readme_json" | jq -r .content 2>/dev/null \
|
||||
| base64 -d 2>/dev/null || echo "")
|
||||
|
||||
content=$(echo "$content" \
|
||||
| sed $'1s/^\xEF\xBB\xBF//' \
|
||||
| sed 's/\r$//')
|
||||
|
||||
if [ "$owner" = "Zacatel" ]; then
|
||||
echo "DEBUG: Normalized content for $owner/$repo (first 10 lines):"
|
||||
echo "$content" | sed -n '1,10p' | sed -n l
|
||||
fi
|
||||
|
||||
if echo "$content" | grep -q 'osuid:'; then
|
||||
echo "DEBUG: 'osuid:' found in $owner/$repo"
|
||||
contents=$(curl -sSL -H "Authorization: token $TOKEN" \
|
||||
"$GITEA_API/repos/$owner/$repo/contents?ref=main")
|
||||
if echo "$contents" | jq -e '.[] | select(.type=="dir" and .name=="Skins")' >/dev/null; then
|
||||
echo "$owner/$repo" >> "$valid_repos_file"
|
||||
echo "added $owner/$repo"
|
||||
repo_matched=true
|
||||
else
|
||||
echo "DEBUG: no osuid in $owner/$repo"
|
||||
fi
|
||||
done
|
||||
|
||||
[ "$repo_matched" = false ] && echo "no matching repos for $user_login"
|
||||
else
|
||||
echo "no repos for $user_login"
|
||||
@@ -98,27 +81,45 @@ jobs:
|
||||
owner=${repo_full%%/*}
|
||||
repo=${repo_full##*/}
|
||||
api="$GITEA_API/repos/$owner/$repo"
|
||||
|
||||
default_branch=$(curl -sSL --fail -H "Authorization: token $TOKEN" \
|
||||
"$api" | jq -r '.default_branch')
|
||||
|
||||
latest_tag=$(curl -sSL --fail -H "Authorization: token $TOKEN" \
|
||||
"$api/tags" | jq -r '.[0].name // empty')
|
||||
if [[ -n "$latest_tag" && "$latest_tag" != "v1.0.0" ]]; then
|
||||
curl -sSL -X DELETE -H "Authorization: token $TOKEN" \
|
||||
"$api/git/refs/tags/$latest_tag" || true
|
||||
fi
|
||||
|
||||
url="$api/contents/$TEMPLATE_PATH"
|
||||
sha=$(curl -sSL -H "Authorization: token $TOKEN" "$url" \
|
||||
| jq -r 'select(.sha != null).sha // empty' || true)
|
||||
|
||||
if [[ -z "$sha" ]]; then
|
||||
action="Add"
|
||||
msg="Add CI from skins-template"
|
||||
payload=$(jq -nc --arg message "$msg" --arg content "$TEMPLATE_B64" --arg branch "$default_branch" '{message: $message, content: $content, branch: $branch}')
|
||||
payload=$(jq -nc \
|
||||
--arg message "$msg" \
|
||||
--arg content "$TEMPLATE_B64" \
|
||||
--arg branch "$default_branch" \
|
||||
'{message: $message, content: $content, branch: $branch}')
|
||||
else
|
||||
action="Update"
|
||||
msg="Update CI from skins-template"
|
||||
payload=$(jq -nc --arg message "$msg" --arg content "$TEMPLATE_B64" --arg sha "$sha" --arg branch "$default_branch" '{message: $message, content: $content, sha: $sha, branch: $branch}')
|
||||
payload=$(jq -nc \
|
||||
--arg message "$msg" \
|
||||
--arg content "$TEMPLATE_B64" \
|
||||
--arg sha "$sha" \
|
||||
--arg branch "$default_branch" \
|
||||
'{message: $message, content: $content, sha: $sha, branch: $branch}')
|
||||
fi
|
||||
if curl -sSL --fail -X PUT -H "Authorization: token $TOKEN" -H "Content-Type: application/json" -d "$payload" "$url" >/dev/null; then
|
||||
|
||||
if curl -sSL --fail -X PUT \
|
||||
-H "Authorization: token $TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "$payload" \
|
||||
"$url" >/dev/null; then
|
||||
echo "✅ $action $owner/$repo on branch $default_branch"
|
||||
else
|
||||
echo "❌ $action failed for $owner/$repo → $url" >&2
|
||||
|
||||
Reference in New Issue
Block a user