fix: create Gitea Release in CI + updater uses releases/latest API
All checks were successful
Build & Sign Wraith / Build Windows + Sign (push) Successful in 1m3s

CI now creates a proper Gitea Release after uploading packages. The
updater queries /api/v1/repos/{owner}/{repo}/releases/latest which
requires a Release object (not just a tag). Previous tags won't have
releases — the updater will start working from this build forward.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Vantz Stockwell 2026-03-17 12:30:45 -04:00
parent 4af90bb80d
commit 4d198e9014
2 changed files with 24 additions and 5 deletions

View File

@ -426,3 +426,20 @@ jobs:
echo "" echo ""
echo "=== Contents ===" echo "=== Contents ==="
ls -la dist/ ls -la dist/
# ===============================================================
# Create Gitea Release
# ===============================================================
- name: Create Gitea Release
run: |
VERSION="${{ steps.version.outputs.version }}"
GITEA_URL="https://git.command.vigilcyber.com"
echo "=== Creating Gitea Release for ${VERSION} ==="
curl -s -X POST \
-H "Authorization: token ${{ secrets.GIT_TOKEN }}" \
-H "Content-Type: application/json" \
-d "{\"tag_name\": \"${VERSION}\", \"name\": \"Wraith ${VERSION}\", \"body\": \"Auto-release from CI build.\"}" \
"${GITEA_URL}/api/v1/repos/vstockwell/wraith/releases"
echo ""
echo "Release created."

View File

@ -80,7 +80,7 @@ func (u *UpdateService) CheckForUpdate() (*UpdateInfo, error) {
} }
// Fetch latest package version from the Gitea API. // Fetch latest package version from the Gitea API.
// Use Gitea releases API to find the latest release tag // Use Gitea releases API to find the latest release
apiURL := fmt.Sprintf( apiURL := fmt.Sprintf(
"%s/api/v1/repos/%s/%s/releases/latest", "%s/api/v1/repos/%s/%s/releases/latest",
u.baseURL, u.owner, u.pkg, u.baseURL, u.owner, u.pkg,
@ -101,13 +101,15 @@ func (u *UpdateService) CheckForUpdate() (*UpdateInfo, error) {
body, err := io.ReadAll(resp.Body) body, err := io.ReadAll(resp.Body)
if err != nil { if err != nil {
return nil, fmt.Errorf("read release API response: %w", err) return nil, fmt.Errorf("read release response: %w", err)
} }
slog.Info("release API response", "status", resp.StatusCode, "body", string(body)[:min(len(body), 500)]) slog.Info("release API response", "status", resp.StatusCode, "bodyLen", len(body))
if resp.StatusCode != http.StatusOK { if resp.StatusCode != http.StatusOK {
return nil, fmt.Errorf("unexpected status %d from releases API: %s", resp.StatusCode, string(body)) // No releases yet — not an error, just nothing to update to
slog.Info("no releases found", "status", resp.StatusCode)
return info, nil
} }
var release giteaRelease var release giteaRelease
@ -116,7 +118,7 @@ func (u *UpdateService) CheckForUpdate() (*UpdateInfo, error) {
} }
if release.TagName == "" { if release.TagName == "" {
slog.Info("no releases found") slog.Info("release has no tag")
return info, nil return info, nil
} }