mirror of
https://github.com/softprops/action-gh-release.git
synced 2025-05-11 19:04:20 +00:00
address asset upload warning
This commit is contained in:
parent
ca4bc532b6
commit
4ea9fd8322
3 changed files with 7 additions and 7 deletions
|
@ -15,11 +15,11 @@ describe("github", () => {
|
||||||
|
|
||||||
describe("asset", () => {
|
describe("asset", () => {
|
||||||
it("derives asset info from a path", async () => {
|
it("derives asset info from a path", async () => {
|
||||||
const { name, mime, size, file } = asset("tests/data/foo/bar.txt");
|
const { name, mime, size, data } = asset("tests/data/foo/bar.txt");
|
||||||
assert.equal(name, "bar.txt");
|
assert.equal(name, "bar.txt");
|
||||||
assert.equal(mime, "text/plain");
|
assert.equal(mime, "text/plain");
|
||||||
assert.equal(size, 10);
|
assert.equal(size, 10);
|
||||||
assert.equal(file.toString(), "release me");
|
assert.equal(data.toString(), "release me");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
2
dist/index.js
vendored
2
dist/index.js
vendored
File diff suppressed because one or more lines are too long
|
@ -8,7 +8,7 @@ export interface ReleaseAsset {
|
||||||
name: string;
|
name: string;
|
||||||
mime: string;
|
mime: string;
|
||||||
size: number;
|
size: number;
|
||||||
file: Buffer;
|
data: Buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Release {
|
export interface Release {
|
||||||
|
@ -116,7 +116,7 @@ export const asset = (path: string): ReleaseAsset => {
|
||||||
name: basename(path),
|
name: basename(path),
|
||||||
mime: mimeOrDefault(path),
|
mime: mimeOrDefault(path),
|
||||||
size: lstatSync(path).size,
|
size: lstatSync(path).size,
|
||||||
file: readFileSync(path)
|
data: readFileSync(path)
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ export const upload = async (
|
||||||
url: string,
|
url: string,
|
||||||
path: string
|
path: string
|
||||||
): Promise<any> => {
|
): Promise<any> => {
|
||||||
let { name, size, mime, file } = asset(path);
|
let { name, size, mime, data } = asset(path);
|
||||||
console.log(`⬆️ Uploading ${name}...`);
|
console.log(`⬆️ Uploading ${name}...`);
|
||||||
return await gh.repos.uploadReleaseAsset({
|
return await gh.repos.uploadReleaseAsset({
|
||||||
url,
|
url,
|
||||||
|
@ -138,7 +138,7 @@ export const upload = async (
|
||||||
"content-type": mime
|
"content-type": mime
|
||||||
},
|
},
|
||||||
name,
|
name,
|
||||||
file
|
data
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue