ops forgejo release: add upload-asset verb #75

Closed
opened 2026-05-25 00:42:19 +00:00 by coilysiren · 0 comments
Owner

Problem

coily ops forgejo release ships CRUD verbs (coilysiren/coily#72) but intentionally deferred asset upload. Operators publishing artifacts (formula tarballs, scoop archives, factorio mods) still have to curl directly.

Scope

Add under coily ops forgejo release:

  • upload-asset --repo <owner/name> --id ID --file PATH [--name N] -> POST /repos/{owner}/{repo}/releases/{id}/assets

Different mechanism than the JSON CRUD path:

  • Content-Type: multipart/form-data with an attachment file part (forgejo accepts name as a form field to override the asset filename).
  • Streamed body rather than json.Marshal -> bytes buffer.
  • Status code 201 on success.

Implementation suggestion: extract a forgejoAPIDoMultipart sibling of forgejoAPIDo that takes a *multipart.Writer, reuses the token fetch + status-code discipline. Validate the source file exists and has non-zero size before upload to fail fast.

Why

Closes the gap left by coilysiren/coily#72. Releases without an asset-upload path mean automation flows still have a curl fallback for the publish step.

**Problem** `coily ops forgejo release` ships CRUD verbs (coilysiren/coily#72) but intentionally deferred asset upload. Operators publishing artifacts (formula tarballs, scoop archives, factorio mods) still have to curl directly. **Scope** Add under `coily ops forgejo release`: - `upload-asset --repo <owner/name> --id ID --file PATH [--name N]` -> `POST /repos/{owner}/{repo}/releases/{id}/assets` Different mechanism than the JSON CRUD path: - `Content-Type: multipart/form-data` with an `attachment` file part (forgejo accepts `name` as a form field to override the asset filename). - Streamed body rather than `json.Marshal` -> bytes buffer. - Status code 201 on success. Implementation suggestion: extract a `forgejoAPIDoMultipart` sibling of `forgejoAPIDo` that takes a `*multipart.Writer`, reuses the token fetch + status-code discipline. Validate the source file exists and has non-zero size before upload to fail fast. **Why** Closes the gap left by coilysiren/coily#72. Releases without an asset-upload path mean automation flows still have a `curl` fallback for the publish step.
Sign in to join this conversation.
No labels
P0
P1
P2
P3
P4
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
coilyco-bridge/coily#75
No description provided.