diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml index 263055a..e0d2b7b 100644 --- a/.gitea/workflows/ci.yaml +++ b/.gitea/workflows/ci.yaml @@ -161,14 +161,34 @@ jobs: - name: Create Gitea release run: | - RELEASE_ID=$(curl -sf -X POST \ - -H "Authorization: token ${{ secrets.GITEARELEASE_TOKEN }}" \ + API="https://git.${{ secrets.DOMAIN }}/api/v1/repos/${{ secrets.REGISTRY_USER }}/etf-oglasi" + AUTH="Authorization: token ${{ secrets.GITEARELEASE_TOKEN }}" + + HTTP_CODE=$(curl -s -o release.json -w "%{http_code}" -X POST \ + -H "$AUTH" \ -H "Content-Type: application/json" \ -d "{\"tag_name\":\"${{ steps.version.outputs.tag }}\",\"target_commitish\":\"${{ github.sha }}\",\"name\":\"${{ steps.version.outputs.tag }}\",\"draft\":false,\"prerelease\":false}" \ - "https://git.${{ secrets.DOMAIN }}/api/v1/repos/${{ secrets.REGISTRY_USER }}/etf-oglasi/releases" \ - | node -pe "JSON.parse(require('fs').readFileSync(0,'utf8')).id") + "$API/releases") - curl -sf -X POST \ - -H "Authorization: token ${{ secrets.GITEARELEASE_TOKEN }}" \ + echo "HTTP $HTTP_CODE" + cat release.json + + if [ "$HTTP_CODE" != "201" ]; then + echo "Failed to create release" + exit 1 + fi + + RELEASE_ID=$(node -pe "JSON.parse(require('fs').readFileSync('release.json','utf8')).id") + + HTTP_CODE=$(curl -s -o asset.json -w "%{http_code}" -X POST \ + -H "$AUTH" \ -F "attachment=@${{ steps.apk.outputs.path }}" \ - "https://git.${{ secrets.DOMAIN }}/api/v1/repos/${{ secrets.REGISTRY_USER }}/etf-oglasi/releases/$RELEASE_ID/assets?name=${{ steps.apk.outputs.name }}" + "$API/releases/$RELEASE_ID/assets?name=${{ steps.apk.outputs.name }}") + + echo "HTTP $HTTP_CODE" + cat asset.json + + if [ "$HTTP_CODE" != "201" ]; then + echo "Failed to upload asset" + exit 1 + fi