mirror of
https://github.com/Kir-Antipov/mc-publish.git
synced 2024-12-28 17:44:54 -05:00
Fixed GitHubPublisher
This commit is contained in:
parent
28eb50d9c1
commit
d8d4fd16a8
1 changed files with 9 additions and 3 deletions
|
@ -6,9 +6,14 @@ import { getFiles } from "../utils/file-utils";
|
|||
interface GitHubPublisherOptions {
|
||||
tag?: string;
|
||||
token: string;
|
||||
files: string;
|
||||
files?: string | { primary?: string, secondary?: string };
|
||||
}
|
||||
|
||||
const defaultFiles = {
|
||||
primary: "build/libs/!(*-@(dev|sources)).jar",
|
||||
secondary: "build/libs/*-@(dev|sources).jar"
|
||||
};
|
||||
|
||||
export default class GitHubPublisher extends Publisher<GitHubPublisherOptions> {
|
||||
public get target(): PublisherTarget {
|
||||
return PublisherTarget.GitHub;
|
||||
|
@ -30,9 +35,10 @@ export default class GitHubPublisher extends Publisher<GitHubPublisherOptions> {
|
|||
throw new Error(`Couldn't find release #${this.options.tag || releaseId}`);
|
||||
}
|
||||
|
||||
const files = await getFiles(this.options.files);
|
||||
const fileSelector = this.options.files && (typeof(this.options.files) === "string" || this.options.files.primary) ? this.options.files : defaultFiles;
|
||||
const files = await getFiles(fileSelector);
|
||||
if (!files.length) {
|
||||
throw new Error("Couldn't find specified files");
|
||||
throw new Error(`Specified files (${typeof fileSelector === "string" ? fileSelector : fileSelector.primary}) were not found`);
|
||||
}
|
||||
|
||||
const existingAssets = (await octokit.rest.repos.listReleaseAssets({ ...repo, release_id: releaseId })).data;
|
||||
|
|
Loading…
Reference in a new issue