diff --git a/.gitea/workflows/deploy-ci.yaml b/.gitea/workflows/deploy-ci.yaml index 0fa53d2..629f14c 100644 --- a/.gitea/workflows/deploy-ci.yaml +++ b/.gitea/workflows/deploy-ci.yaml @@ -19,7 +19,6 @@ 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) @@ -28,7 +27,6 @@ jobs: - name: Fetch valid user repositories shell: bash run: | - set -eo pipefail page=1 per_page=50 valid_repos_file=$(mktemp) @@ -76,34 +74,25 @@ jobs: echo "VALID_REPOS_FILE=$valid_repos_file" >> $GITHUB_ENV - - name: Update CI via Gitea API (with debug) + - name: Update CI via Gitea API shell: bash run: | - set -euxo pipefail + set -eo 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') - 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/tags/$latest_tag" -w "%{http_code}" -o /dev/null) || delete_response=error - echo "Delete response code: $delete_response" + if [[ -n "$latest_tag" && "$latest_tag" != "v1.0.0" ]]; then + curl -sSL -X DELETE -H "Authorization: token $TOKEN" \ + "$api/tags/$latest_tag" || true fi url="$api/contents/$TEMPLATE_PATH"