Update the wiki uploading to be generic enough to work for any desired extra release files
This commit is contained in:
parent
c7410e0c65
commit
edfb087341
1 changed files with 6 additions and 10 deletions
|
|
@ -3,7 +3,7 @@ import { config } from "dotenv";
|
||||||
import { assertEnvKey, addReleaseAsset } from "./utils.mjs";
|
import { assertEnvKey, addReleaseAsset } from "./utils.mjs";
|
||||||
|
|
||||||
config({ quiet: true });
|
config({ quiet: true });
|
||||||
assertEnvKey("MANIFEST");
|
assertEnvKey("ASSET");
|
||||||
assertEnvKey("TAG");
|
assertEnvKey("TAG");
|
||||||
assertEnvKey("FORGEJO_SERVER_URL");
|
assertEnvKey("FORGEJO_SERVER_URL");
|
||||||
assertEnvKey("FORGEJO_API_URL");
|
assertEnvKey("FORGEJO_API_URL");
|
||||||
|
|
@ -11,15 +11,9 @@ assertEnvKey("FORGEJO_REPOSITORY");
|
||||||
assertEnvKey("FORGEJO_TOKEN");
|
assertEnvKey("FORGEJO_TOKEN");
|
||||||
assertEnvKey("FORGEJO_REF_NAME");
|
assertEnvKey("FORGEJO_REF_NAME");
|
||||||
|
|
||||||
const MANIFEST_FILE = process.env.MANIFEST;
|
|
||||||
const MANIFEST_NAME = MANIFEST_FILE.split(`/`).at(-1);
|
|
||||||
if (!MANIFEST_NAME) {
|
|
||||||
console.error(`Failed to parse manifest name from: ${MANIFEST_FILE}`);
|
|
||||||
process.exit(1);
|
|
||||||
};
|
|
||||||
|
|
||||||
const {
|
const {
|
||||||
TAG,
|
TAG,
|
||||||
|
ASSET,
|
||||||
FORGEJO_API_URL: API,
|
FORGEJO_API_URL: API,
|
||||||
FORGEJO_REPOSITORY: REPO,
|
FORGEJO_REPOSITORY: REPO,
|
||||||
FORGEJO_TOKEN: TOKEN,
|
FORGEJO_TOKEN: TOKEN,
|
||||||
|
|
@ -33,11 +27,13 @@ const release = await axios.get(
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const filename = ASSET.split(`/`).at(-1);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await addReleaseAsset(
|
await addReleaseAsset(
|
||||||
release.data.upload_url,
|
release.data.upload_url,
|
||||||
`wiki.zip`,
|
filename,
|
||||||
`wiki.zip`,
|
ASSET,
|
||||||
{ TOKEN },
|
{ TOKEN },
|
||||||
);
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
Loading…
Add table
Add a link
Reference in a new issue