This commit is contained in:
@@ -42,15 +42,72 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
WINEDEBUG: '-all'
|
WINEDEBUG: '-all'
|
||||||
|
|
||||||
- name: Create Gitea Release & Upload
|
- name: Create Gitea Release
|
||||||
uses: akkuman/gitea-release-action@v1
|
run: |
|
||||||
env:
|
GITEA_URL="http://10.0.0.119:3000"
|
||||||
NODE_OPTIONS: '--experimental-fetch'
|
TAG="${GITHUB_REF_NAME}"
|
||||||
with:
|
REPO="${GITHUB_REPOSITORY}"
|
||||||
server_url: http://10.0.0.119:3000
|
TOKEN="${{ gitea.token }}"
|
||||||
files: |-
|
|
||||||
out/make/**/*.exe
|
# Check if release exists, create if not
|
||||||
out/make/**/*.zip
|
RELEASE_ID=$(curl -sf \
|
||||||
out/make/**/*.deb
|
-H "Authorization: token ${TOKEN}" \
|
||||||
out/make/**/*.rpm
|
"${GITEA_URL}/api/v1/repos/${REPO}/releases/tags/${TAG}" \
|
||||||
token: ${{ gitea.token }}
|
| grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)
|
||||||
|
|
||||||
|
if [ -z "$RELEASE_ID" ]; then
|
||||||
|
RELEASE_ID=$(curl -sf \
|
||||||
|
-X POST \
|
||||||
|
-H "Authorization: token ${TOKEN}" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d "{\"tag_name\":\"${TAG}\",\"name\":\"${TAG}\"}" \
|
||||||
|
"${GITEA_URL}/api/v1/repos/${REPO}/releases" \
|
||||||
|
| grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Release ID: ${RELEASE_ID}"
|
||||||
|
echo "RELEASE_ID=${RELEASE_ID}" >> "$GITHUB_ENV"
|
||||||
|
|
||||||
|
- name: Upload Release Assets
|
||||||
|
run: |
|
||||||
|
GITEA_URL="http://10.0.0.119:3000"
|
||||||
|
REPO="${GITHUB_REPOSITORY}"
|
||||||
|
TOKEN="${{ gitea.token }}"
|
||||||
|
MAX_RETRIES=3
|
||||||
|
|
||||||
|
upload_file() {
|
||||||
|
local file="$1"
|
||||||
|
local name=$(basename "$file")
|
||||||
|
local attempt=1
|
||||||
|
|
||||||
|
while [ $attempt -le $MAX_RETRIES ]; do
|
||||||
|
echo "Uploading ${name} (attempt ${attempt}/${MAX_RETRIES})..."
|
||||||
|
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" \
|
||||||
|
-X POST \
|
||||||
|
-H "Authorization: token ${TOKEN}" \
|
||||||
|
-F "attachment=@${file}" \
|
||||||
|
"${GITEA_URL}/api/v1/repos/${REPO}/releases/${RELEASE_ID}/assets?name=${name}")
|
||||||
|
|
||||||
|
if [ "$HTTP_CODE" -ge 200 ] && [ "$HTTP_CODE" -lt 300 ]; then
|
||||||
|
echo "✅ Uploaded ${name}"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "⚠️ Upload failed (HTTP ${HTTP_CODE}), retrying in 5s..."
|
||||||
|
sleep 5
|
||||||
|
attempt=$((attempt + 1))
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "❌ Failed to upload ${name} after ${MAX_RETRIES} attempts"
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
FAILED=0
|
||||||
|
for file in $(find out/make -type f \( -name "*.exe" -o -name "*.zip" -o -name "*.deb" -o -name "*.rpm" \)); do
|
||||||
|
upload_file "$file" || FAILED=1
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ $FAILED -eq 1 ]; then
|
||||||
|
echo "Some uploads failed"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user