Skip to content

Commit

Permalink
更改更新方式为只更新 vndb-data-Latest.json
Browse files Browse the repository at this point in the history
  • Loading branch information
youyou-sudo authored Sep 4, 2024
1 parent 4f6c048 commit c6799b1
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions .github/workflows/vndb-process.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,28 @@ jobs:
RELEASE_TAG="v1.0.0"
FILE_PATH="vn_data.json"
FILE_NAME="vndb-data-Latest.json"
REPO="youyou-sudo/vndb-search-datas"
# Get the release ID
RELEASE_ID=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \
"https://api.github.com/repos/$REPO/releases/tags/$RELEASE_TAG" | jq -r '.id')
# Get the asset ID for the old file
ASSET_ID=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \
"https://api.github.com/repos/$REPO/releases/$RELEASE_ID/assets" | jq -r '.[] | select(.name == "'"$FILE_NAME"'") | .id')
# Delete the old file
if [ "$ASSET_ID" != "null" ]; then
curl -s -X DELETE -H "Authorization: token $GITHUB_TOKEN" \
"https://api.github.com/repos/$REPO/releases/assets/$ASSET_ID"
fi
# Upload the file to the existing release
# Upload the new file
RESPONSE=$(curl -s -X POST \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Accept: application/vnd.github+json" \
-H "Content-Type: application/zip" \
--data-binary @"$FILE_PATH" \
"https://uploads.github.com/repos/youyou-sudo/vndb-search-datas/releases/173481051/assets?name=$FILE_NAME")
"https://uploads.github.com/repos/$REPO/releases/$RELEASE_ID/assets?name=$FILE_NAME")
echo "Response: $RESPONSE"

0 comments on commit c6799b1

Please sign in to comment.