Update .gitea/workflows/deploy-ci.yaml
All checks were successful
Update Community Skins README / Full CI/CD Pipeline (push) Successful in 4s
All checks were successful
Update Community Skins README / Full CI/CD Pipeline (push) Successful in 4s
This commit is contained in:
@@ -19,6 +19,7 @@ jobs:
|
||||
- name: Fetch CI template via Gitea API
|
||||
shell: bash
|
||||
run: |
|
||||
set -eo pipefail
|
||||
resp=$(curl -sSL -H "Authorization: token $TOKEN" \
|
||||
"$GITEA_API/repos/osc/skins-template/contents/$TEMPLATE_PATH?ref=main")
|
||||
template_b64=$(echo "$resp" | jq -r .content)
|
||||
@@ -27,6 +28,7 @@ jobs:
|
||||
- name: Fetch valid user repositories
|
||||
shell: bash
|
||||
run: |
|
||||
set -eo pipefail
|
||||
page=1
|
||||
per_page=50
|
||||
valid_repos_file=$(mktemp)
|
||||
@@ -74,24 +76,34 @@ jobs:
|
||||
|
||||
echo "VALID_REPOS_FILE=$valid_repos_file" >> $GITHUB_ENV
|
||||
|
||||
- name: Update CI via Gitea API
|
||||
- name: Update CI via Gitea API (with debug)
|
||||
shell: bash
|
||||
run: |
|
||||
set -eo pipefail
|
||||
set -euxo pipefail
|
||||
mapfile -t repos < "$VALID_REPOS_FILE"
|
||||
for repo_full in "${repos[@]}"; do
|
||||
owner=${repo_full%%/*}
|
||||
repo=${repo_full##*/}
|
||||
api="$GITEA_API/repos/$owner/$repo"
|
||||
|
||||
echo "Processing $owner/$repo"
|
||||
default_branch=$(curl -sSL --fail -H "Authorization: token $TOKEN" \
|
||||
"$api" | jq -r '.default_branch')
|
||||
echo "Default branch: $default_branch"
|
||||
|
||||
latest_tag=$(curl -sSL --fail -H "Authorization: token $TOKEN" \
|
||||
"$api/tags" | jq -r '.[0].name // empty')
|
||||
if [[ "$latest_tag" != "v1.0.0" ]]; then
|
||||
curl -sSL -X DELETE -H "Authorization: token $TOKEN" \
|
||||
"$api/git/refs/tags/$latest_tag" || true
|
||||
echo "Latest tag: '$latest_tag'"
|
||||
|
||||
if [[ -z "$latest_tag" ]]; then
|
||||
echo "No tags found, skipping deletion"
|
||||
elif [[ "$latest_tag" == "v1.0.0" ]]; then
|
||||
echo "Skipping deletion for protected tag v1.0.0"
|
||||
else
|
||||
echo "Deleting tag '$latest_tag'"
|
||||
delete_response=$(curl -sSL -X DELETE -H "Authorization: token $TOKEN" \
|
||||
"$api/git/refs/tags/$latest_tag" -w "%{http_code}" -o /dev/null) || delete_response=error
|
||||
echo "Delete response code: $delete_response"
|
||||
fi
|
||||
|
||||
url="$api/contents/$TEMPLATE_PATH"
|
||||
|
||||
Reference in New Issue
Block a user