ci: migrate coverage badge to Gitea Packages
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
Replace commit-based badge update with a single PUT to the Gitea generic packages API. Removes the badges/ directory from the repo and eliminates CI commits on every push. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
99032d5bcb
commit
32b8b37a5e
32
.drone.yml
32
.drone.yml
@ -31,35 +31,11 @@ steps:
|
||||
else FILL="#e05d44"; fi
|
||||
echo "PCT=$PCT FILL=$FILL"
|
||||
printf '<svg xmlns="http://www.w3.org/2000/svg" width="120" height="20"><rect width="76" height="20" fill="#555"/><rect x="76" width="44" height="20" fill="%s"/><g fill="#fff" text-anchor="middle" font-family="sans-serif" font-size="11"><text x="38" y="14">coverage</text><text x="98" y="14">%s%%</text></g></svg>' "$FILL" "$PCT" > coverage.svg
|
||||
CONTENT=$(base64 coverage.svg | tr -d '\n')
|
||||
echo "Content length: ${#CONTENT}"
|
||||
SHA_RESP=$(curl -s \
|
||||
curl -fsSL -X PUT \
|
||||
-H "Authorization: token $GITEA_TOKEN" \
|
||||
"https://git.cincoeuzebio.com/api/v1/repos/cinco/Tmuxido/contents/badges/coverage.svg?ref=main")
|
||||
echo "SHA response: $SHA_RESP"
|
||||
SHA=$(echo "$SHA_RESP" | jq -r '.sha // empty')
|
||||
echo "SHA: '$SHA'"
|
||||
if [ -n "$SHA" ]; then
|
||||
PAYLOAD=$(jq -n --arg msg "ci: update coverage badge [CI SKIP]" \
|
||||
--arg content "$CONTENT" --arg sha "$SHA" --arg branch "main" \
|
||||
'{message: $msg, content: $content, sha: $sha, branch: $branch}')
|
||||
RESPONSE=$(curl -s -X PUT \
|
||||
-H "Authorization: token $GITEA_TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
"https://git.cincoeuzebio.com/api/v1/repos/cinco/Tmuxido/contents/badges/coverage.svg" \
|
||||
-d "$PAYLOAD")
|
||||
else
|
||||
PAYLOAD=$(jq -n --arg msg "ci: add coverage badge [CI SKIP]" \
|
||||
--arg content "$CONTENT" --arg branch "main" \
|
||||
'{message: $msg, content: $content, branch: $branch}')
|
||||
RESPONSE=$(curl -s -X POST \
|
||||
-H "Authorization: token $GITEA_TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
"https://git.cincoeuzebio.com/api/v1/repos/cinco/Tmuxido/contents/badges/coverage.svg" \
|
||||
-d "$PAYLOAD")
|
||||
fi
|
||||
echo "API response: $RESPONSE"
|
||||
echo "$RESPONSE" | tr -d '\n' | jq -e '.content.sha' > /dev/null
|
||||
-H "Content-Type: image/svg+xml" \
|
||||
--data-binary @coverage.svg \
|
||||
"https://git.cincoeuzebio.com/api/packages/cinco/generic/badges/latest/coverage.svg"
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
# tmuxido
|
||||
|
||||
[](https://drone.cincoeuzebio.com/cinco/Tmuxido)
|
||||
[](https://drone.cincoeuzebio.com/cinco/Tmuxido)
|
||||
[](https://drone.cincoeuzebio.com/cinco/Tmuxido)
|
||||
[](https://git.cincoeuzebio.com/cinco/Tmuxido/releases)
|
||||

|
||||
|
||||
|
||||
@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="120" height="20"><rect width="76" height="20" fill="#555"/><rect x="76" width="44" height="20" fill="#e05d44"/><g fill="#fff" text-anchor="middle" font-family="sans-serif" font-size="11"><text x="38" y="14">coverage</text><text x="98" y="14">35%</text></g></svg>
|
||||
|
Before Width: | Height: | Size: 309 B |
Loading…
x
Reference in New Issue
Block a user