Update the forgejo release script to upload directly to Forgejo instead of

This commit is contained in:
Oliver 2026-01-13 22:41:23 -07:00
parent 075562c656
commit fc0a289866

View file

@ -1,3 +1,4 @@
import { createReadStream } from "fs";
import axios from "axios"; import axios from "axios";
const { const {
@ -7,15 +8,13 @@ const {
FORGEJO_REPOSITORY: REPO, FORGEJO_REPOSITORY: REPO,
FORGEJO_TOKEN: TOKEN, FORGEJO_TOKEN: TOKEN,
FORGEJO_REF_NAME: TARGET_REF, FORGEJO_REF_NAME: TARGET_REF,
CDN_URL,
} = process.env; } = process.env;
// TODO: make this upload the file to Forgejo async function addReleaseAsset(releaseID, name, filepath) {
async function addReleaseAsset(releaseID, name) { const stream = createReadStream(filepath);
return;
return axios.post( return axios.post(
`${API}/repos/${REPO}/releases/${releaseID}/assets`, `${API}/repos/${REPO}/releases/${releaseID}/assets`,
{ external_url: `${CDN_URL}/${REPO}/${TAG}/${name}`, }, { attachment: stream, },
{ {
headers: { headers: {
Authorization: `token ${TOKEN}`, Authorization: `token ${TOKEN}`,