mirror of
https://github.com/dexoron/dcr.git
synced 2026-10-21 16:19:37 +00:00
fix release sync
This commit is contained in:
12
.github/workflows/ci.yml
vendored
12
.github/workflows/ci.yml
vendored
@@ -6,7 +6,19 @@ on:
|
|||||||
- master
|
- master
|
||||||
- main
|
- main
|
||||||
- dev
|
- dev
|
||||||
|
paths:
|
||||||
|
- 'src/**'
|
||||||
|
- 'tests/**'
|
||||||
|
- 'Cargo.toml'
|
||||||
|
- 'Cargo.lock'
|
||||||
|
- '.github/workflows/ci.yml'
|
||||||
pull_request:
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- 'src/**'
|
||||||
|
- 'tests/**'
|
||||||
|
- 'Cargo.toml'
|
||||||
|
- 'Cargo.lock'
|
||||||
|
- '.github/workflows/ci.yml'
|
||||||
|
|
||||||
env:
|
env:
|
||||||
CARGO_TERM_COLOR: always
|
CARGO_TERM_COLOR: always
|
||||||
|
|||||||
47
.github/workflows/release-mirror.yml
vendored
47
.github/workflows/release-mirror.yml
vendored
@@ -150,18 +150,41 @@ jobs:
|
|||||||
uploaded=0; failed=0
|
uploaded=0; failed=0
|
||||||
for file in assets/*; do
|
for file in assets/*; do
|
||||||
[ -f "$file" ] || continue
|
[ -f "$file" ] || continue
|
||||||
upload=$(curl -fsSL -X POST -H "PRIVATE-TOKEN: $GITVERSE_PAT" \
|
|
||||||
-F "file=@$file" "https://gitverse.ru/api/v4/projects/${project}/uploads")
|
|
||||||
url=$(jq -r '.url // .file_path' <<< "$upload")
|
|
||||||
name=$(basename "$file")
|
name=$(basename "$file")
|
||||||
link=$(jq -n --arg name "$name" --arg url "$url" '{name:$name,url:$url}')
|
|
||||||
if curl -fsSL -X POST -H "PRIVATE-TOKEN: $GITVERSE_PAT" \
|
# Step 1: Upload file and capture response with HTTP code
|
||||||
-H 'Content-Type: application/json' --data "$link" \
|
upload_response=$(curl -sS -w "\n%{http_code}" -X POST -H "PRIVATE-TOKEN: $GITVERSE_PAT" \
|
||||||
"https://gitverse.ru/api/v4/projects/${project}/releases/${TAG}/assets/links" >/dev/null 2>&1; then
|
-F "file=@$file" "https://gitverse.ru/api/v4/projects/${project}/uploads")
|
||||||
uploaded=$((uploaded+1))
|
http_code=$(echo "$upload_response" | tail -n1)
|
||||||
else
|
body=$(echo "$upload_response" | sed '$d')
|
||||||
echo "::warning::GitVerse: failed to attach asset $name"
|
|
||||||
|
if [ "$http_code" != "201" ] && [ "$http_code" != "200" ]; then
|
||||||
|
echo "::warning::GitVerse: failed to upload $name (HTTP $http_code): $body"
|
||||||
failed=$((failed+1))
|
failed=$((failed+1))
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Extract file path from upload response
|
||||||
|
url=$(jq -r '.url // .file_path' <<< "$body" 2>/dev/null || echo "")
|
||||||
|
if [ -z "$url" ]; then
|
||||||
|
echo "::warning::GitVerse: failed to parse upload response for $name: $body"
|
||||||
|
failed=$((failed+1))
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Step 2: Create asset link in release
|
||||||
|
link=$(jq -n --arg name "$name" --arg url "$url" '{name:$name,url:$url}')
|
||||||
|
link_response=$(curl -sS -w "\n%{http_code}" -X POST -H "PRIVATE-TOKEN: $GITVERSE_PAT" \
|
||||||
|
-H 'Content-Type: application/json' --data "$link" \
|
||||||
|
"https://gitverse.ru/api/v4/projects/${project}/releases/${TAG}/assets/links")
|
||||||
|
link_http=$(echo "$link_response" | tail -n1)
|
||||||
|
link_body=$(echo "$link_response" | sed '$d')
|
||||||
|
|
||||||
|
if [ "$link_http" != "201" ] && [ "$link_http" != "200" ]; then
|
||||||
|
echo "::warning::GitVerse: failed to attach asset $name (HTTP $link_http): $link_body"
|
||||||
|
failed=$((failed+1))
|
||||||
|
else
|
||||||
|
uploaded=$((uploaded+1))
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
echo "GitVerse: uploaded ${uploaded}, failed ${failed}"
|
echo "GitVerse: uploaded ${uploaded}, failed ${failed}"
|
||||||
@@ -215,8 +238,8 @@ jobs:
|
|||||||
for file in assets/*; do
|
for file in assets/*; do
|
||||||
[ -f "$file" ] || continue
|
[ -f "$file" ] || continue
|
||||||
if curl -fsSL -X POST -H "Authorization: Bearer $SOURCECRAFT_PAT" \
|
if curl -fsSL -X POST -H "Authorization: Bearer $SOURCECRAFT_PAT" \
|
||||||
-F "name=$(basename "$file")" -F "file=@$file" \
|
-F "file=@$file" \
|
||||||
"${base}/releases/tag/${TAG}/attachments" >/dev/null 2>&1; then
|
"${base}/releases/tag/${TAG}/assets" >/dev/null 2>&1; then
|
||||||
uploaded=$((uploaded+1))
|
uploaded=$((uploaded+1))
|
||||||
else
|
else
|
||||||
echo "::warning::SourceCraft: failed to attach asset $(basename "$file")"
|
echo "::warning::SourceCraft: failed to attach asset $(basename "$file")"
|
||||||
|
|||||||
Reference in New Issue
Block a user