utilize formatted upload url

This commit is contained in:
softprops 2021-08-07 23:31:49 -04:00
parent 3c2ce6b9bd
commit 935aebbf1d
2 changed files with 11 additions and 5 deletions

4
dist/index.js vendored
View file

@ -2139,14 +2139,14 @@ function run() {
} }
}); });
//); //);
let rel = yield github_1.release(config, new github_1.GitHubReleaser(gh)); const rel = yield github_1.release(config, new github_1.GitHubReleaser(gh));
if (config.input_files) { if (config.input_files) {
const files = util_1.paths(config.input_files); const files = util_1.paths(config.input_files);
if (files.length == 0) { if (files.length == 0) {
console.warn(`🤔 ${config.input_files} not include valid file.`); console.warn(`🤔 ${config.input_files} not include valid file.`);
} }
yield Promise.all(files.map((path) => __awaiter(this, void 0, void 0, function* () { yield Promise.all(files.map((path) => __awaiter(this, void 0, void 0, function* () {
yield github_1.upload(gh, rel.upload_url, path); yield github_1.upload(gh, util_1.uploadUrl(rel.upload_url), path);
}))).catch(error => { }))).catch(error => {
throw error; throw error;
}); });

View file

@ -1,4 +1,10 @@
import { paths, parseConfig, isTag, unmatchedPatterns } from "./util"; import {
paths,
parseConfig,
isTag,
unmatchedPatterns,
uploadUrl
} from "./util";
import { release, upload, GitHubReleaser } from "./github"; import { release, upload, GitHubReleaser } from "./github";
import { getOctokit } from "@actions/github"; import { getOctokit } from "@actions/github";
import { setFailed, setOutput } from "@actions/core"; import { setFailed, setOutput } from "@actions/core";
@ -53,7 +59,7 @@ async function run() {
} }
}); });
//); //);
let rel = await release(config, new GitHubReleaser(gh)); const rel = await release(config, new GitHubReleaser(gh));
if (config.input_files) { if (config.input_files) {
const files = paths(config.input_files); const files = paths(config.input_files);
if (files.length == 0) { if (files.length == 0) {
@ -61,7 +67,7 @@ async function run() {
} }
await Promise.all( await Promise.all(
files.map(async path => { files.map(async path => {
await upload(gh, rel.upload_url, path); await upload(gh, uploadUrl(rel.upload_url), path);
}) })
).catch(error => { ).catch(error => {
throw error; throw error;