Fix Windows upload: rewrite release upload in cmd instead of bash
All checks were successful
Build App / build-windows (push) Successful in 3m6s
Build App / build-linux (push) Successful in 4m17s

The Windows runner doesn't have bash. Rewrite the Gitea release
API upload step using cmd batch syntax.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-27 08:13:20 -08:00
parent fb8161dc0d
commit 9454f30b4d

View File

@@ -182,27 +182,17 @@ jobs:
- name: Upload to Gitea release - name: Upload to Gitea release
if: gitea.event_name == 'push' if: gitea.event_name == 'push'
shell: bash
env: env:
TOKEN: ${{ secrets.REGISTRY_TOKEN }} TOKEN: ${{ secrets.REGISTRY_TOKEN }}
COMMIT_SHA: ${{ gitea.sha }}
run: | run: |
TAG="build-win-$(echo ${{ gitea.sha }} | cut -c1-7)" set "TAG=build-win-%COMMIT_SHA:~0,7%"
# Create release echo Creating release %TAG%...
curl -s -X POST \ curl -s -X POST -H "Authorization: token %TOKEN%" -H "Content-Type: application/json" -d "{\"tag_name\": \"%TAG%\", \"name\": \"Windows Build %TAG%\", \"body\": \"Automated build from commit %COMMIT_SHA%\"}" "%GITEA_URL%/api/v1/repos/%REPO%/releases" > release.json
-H "Authorization: token ${TOKEN}" \ for /f "tokens=2 delims=:," %%a in ('findstr /c:"\"id\"" release.json') do set "RELEASE_ID=%%a" & goto :found
-H "Content-Type: application/json" \ :found
-d "{\"tag_name\": \"${TAG}\", \"name\": \"Windows Build ${TAG}\", \"body\": \"Automated build from commit ${{ gitea.sha }}\"}" \ echo Release ID: %RELEASE_ID%
"${GITEA_URL}/api/v1/repos/${REPO}/releases" > release.json for %%f in (artifacts\*) do (
RELEASE_ID=$(cat release.json | grep -o '"id":[0-9]*' | head -1 | grep -o '[0-9]*') echo Uploading %%~nxf...
echo "Release ID: ${RELEASE_ID}" curl -s -X POST -H "Authorization: token %TOKEN%" -H "Content-Type: application/octet-stream" --data-binary "@%%f" "%GITEA_URL%/api/v1/repos/%REPO%/releases/%RELEASE_ID%/assets?name=%%~nxf"
# Upload each artifact )
for file in artifacts/*; do
[ -f "$file" ] || continue
filename=$(basename "$file")
echo "Uploading ${filename}..."
curl -s -X POST \
-H "Authorization: token ${TOKEN}" \
-H "Content-Type: application/octet-stream" \
--data-binary "@${file}" \
"${GITEA_URL}/api/v1/repos/${REPO}/releases/${RELEASE_ID}/assets?name=${filename}"
done