Flesh out releases
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
name: 'Node 12 Template Action'
|
||||
name: 'Release'
|
||||
description: 'Creates github releases'
|
||||
author: 'Nick Cipollo'
|
||||
inputs:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Context } from "@actions/github/lib/context";
|
||||
import { GitHub } from "@actions/github";
|
||||
import { Response, ReposCreateReleaseResponse } from "@octokit/rest";
|
||||
import { AnyResponse, Response, ReposCreateReleaseResponse } from "@octokit/rest";
|
||||
|
||||
export class Releases {
|
||||
context: Context
|
||||
@@ -11,14 +11,39 @@ export class Releases {
|
||||
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({
|
||||
name: "Test release",
|
||||
draft: true,
|
||||
body: body,
|
||||
name: name,
|
||||
draft: draft,
|
||||
owner: this.context.repo.owner,
|
||||
repo: this.context.repo.repo,
|
||||
target_commitish: commitHash,
|
||||
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