Flesh out releases
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
name: 'Node 12 Template Action'
|
name: 'Release'
|
||||||
description: 'Creates github releases'
|
description: 'Creates github releases'
|
||||||
author: 'Nick Cipollo'
|
author: 'Nick Cipollo'
|
||||||
inputs:
|
inputs:
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { Context } from "@actions/github/lib/context";
|
import { Context } from "@actions/github/lib/context";
|
||||||
import { GitHub } from "@actions/github";
|
import { GitHub } from "@actions/github";
|
||||||
import { Response, ReposCreateReleaseResponse } from "@octokit/rest";
|
import { AnyResponse, Response, ReposCreateReleaseResponse } from "@octokit/rest";
|
||||||
|
|
||||||
export class Releases {
|
export class Releases {
|
||||||
context: Context
|
context: Context
|
||||||
@@ -11,14 +11,39 @@ export class Releases {
|
|||||||
this.git = git
|
this.git = git
|
||||||
}
|
}
|
||||||
|
|
||||||
async create(tag: string, commitHash?: string): Promise<Response<ReposCreateReleaseResponse>> {
|
create(
|
||||||
|
tag: string,
|
||||||
|
body?: string,
|
||||||
|
commitHash?: string,
|
||||||
|
draft?: boolean,
|
||||||
|
name?: string
|
||||||
|
): Promise<Response<ReposCreateReleaseResponse>> {
|
||||||
return this.git.repos.createRelease({
|
return this.git.repos.createRelease({
|
||||||
name: "Test release",
|
body: body,
|
||||||
draft: true,
|
name: name,
|
||||||
|
draft: draft,
|
||||||
owner: this.context.repo.owner,
|
owner: this.context.repo.owner,
|
||||||
repo: this.context.repo.repo,
|
repo: this.context.repo.repo,
|
||||||
target_commitish: commitHash,
|
target_commitish: commitHash,
|
||||||
tag_name: tag
|
tag_name: tag
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uploadArtifact(
|
||||||
|
assetUrl: string,
|
||||||
|
contentLength: number,
|
||||||
|
contentType: string,
|
||||||
|
file: string,
|
||||||
|
name: string
|
||||||
|
): Promise<Response<AnyResponse>> {
|
||||||
|
return this.git.repos.uploadReleaseAsset({
|
||||||
|
url: assetUrl,
|
||||||
|
headers: {
|
||||||
|
"content-length": contentLength,
|
||||||
|
"content-type": contentType
|
||||||
|
},
|
||||||
|
file: file,
|
||||||
|
name: name
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user