Update the forgejo release script to upload directly to Forgejo instead of
This commit is contained in:
parent
075562c656
commit
fc0a289866
1 changed files with 4 additions and 5 deletions
|
|
@ -1,3 +1,4 @@
|
|||
import { createReadStream } from "fs";
|
||||
import axios from "axios";
|
||||
|
||||
const {
|
||||
|
|
@ -7,15 +8,13 @@ const {
|
|||
FORGEJO_REPOSITORY: REPO,
|
||||
FORGEJO_TOKEN: TOKEN,
|
||||
FORGEJO_REF_NAME: TARGET_REF,
|
||||
CDN_URL,
|
||||
} = process.env;
|
||||
|
||||
// TODO: make this upload the file to Forgejo
|
||||
async function addReleaseAsset(releaseID, name) {
|
||||
return;
|
||||
async function addReleaseAsset(releaseID, name, filepath) {
|
||||
const stream = createReadStream(filepath);
|
||||
return axios.post(
|
||||
`${API}/repos/${REPO}/releases/${releaseID}/assets`,
|
||||
{ external_url: `${CDN_URL}/${REPO}/${TAG}/${name}`, },
|
||||
{ attachment: stream, },
|
||||
{
|
||||
headers: {
|
||||
Authorization: `token ${TOKEN}`,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue