fix: Replace gh CLI with direct Gitea API calls (curl)

Root cause found via SSH log analysis (actions_log/.../2326.log):
  'gh release create' failed with exit code 127 (command not found).
  The act_runner Docker image used for jobs does not ship the
  GitHub CLI (gh), so any step relying on it fails immediately.

Fix: Replace gh CLI calls with direct Gitea REST API calls using
curl, which is available in the base image:
  1. POST /repos/{repo}/releases -- create release, parse id via python3
  2. POST /repos/{repo}/releases/{id}/assets -- upload artifact as multipart

This removes the gh CLI dependency entirely and matches how
deploy-prod.yml already talks to Gitea (curl + REST API).
This commit is contained in:
2026-07-12 00:18:29 +09:00
parent b7591fb381
commit 6ab270fe92
+27 -14
View File
@@ -125,26 +125,39 @@ jobs:
env: env:
VERSION: ${{ steps.metadata.outputs.version }} VERSION: ${{ steps.metadata.outputs.version }}
COMMIT: ${{ steps.metadata.outputs.commit }} COMMIT: ${{ steps.metadata.outputs.commit }}
GITHUB_TOKEN: ${{ secrets.GITEA_TOKEN }} GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
run: | run: |
ARTIFACT="quantengine_${VERSION}.tar.gz" ARTIFACT="quantengine_${VERSION}.tar.gz"
API="https://gitea.taxbaik.com/api/v1"
REPO="kjh2064/QuantEngineByItz"
echo "Checking artifact..." test -s "$ARTIFACT" || { echo "ERROR: artifact missing: $ARTIFACT"; exit 1; }
ls -lh "$ARTIFACT" || echo "⚠️ Artifact not found: $ARTIFACT"
echo "" echo "Creating release $VERSION via Gitea API..."
echo "Checking gh CLI..." RELEASE_JSON=$(curl -sf -X POST \
which gh || echo "⚠️ gh CLI not found" -H "Authorization: token ${GITEA_TOKEN}" \
gh version || echo "⚠️ gh version failed" -H "Content-Type: application/json" \
-d "{\"tag_name\":\"${VERSION}\",\"name\":\"Release ${VERSION}\",\"body\":\"Release Version: ${VERSION} | Commit: ${COMMIT}\",\"target_commitish\":\"main\"}" \
"${API}/repos/${REPO}/releases")
echo "" RELEASE_ID=$(echo "$RELEASE_JSON" | python3 -c "import sys,json; print(json.load(sys.stdin)['id'])")
echo "Creating release..."
gh release create "$VERSION" "$ARTIFACT" \ if [ -z "$RELEASE_ID" ] || [ "$RELEASE_ID" = "null" ]; then
--title "Release $VERSION" \ echo "ERROR: Failed to create release"
--notes "Release Version: $VERSION | Commit: ${COMMIT}" \ echo "$RELEASE_JSON"
--repo kjh2064/QuantEngineByItz exit 1
fi
echo "✓ Release created: $VERSION (id: $RELEASE_ID)"
echo "Uploading artifact..."
curl -sf -X POST \
-H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: multipart/form-data" \
-F "attachment=@${ARTIFACT}" \
"${API}/repos/${REPO}/releases/${RELEASE_ID}/assets?name=${ARTIFACT}" \
-o /dev/null
echo "✓ Release created: $VERSION"
echo "✓ Artifact attached: $ARTIFACT" echo "✓ Artifact attached: $ARTIFACT"
notification: notification: