-
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0b1c29c
commit 85c3907
Showing
4 changed files
with
43 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
const fs = require("fs").promises; | ||
const path = require("path"); | ||
|
||
const ARTIFACTS_PATH = "./artifacts"; | ||
|
||
const createRelease = async ({github, context}) => { | ||
const owner = context.repo.owner; | ||
const repo = context.repo.repo; | ||
const tag_name = context.ref.replace(/refs\/tags\//, ''); | ||
|
||
const res = github.rest.repos.createRelease({ | ||
owner, | ||
repo, | ||
tag_name, | ||
name: "Release " + tag_name, | ||
body: "TODO", | ||
draft: true, | ||
}); | ||
|
||
const artifacts = await fs.readdir(ARTIFACTS_PATH); | ||
|
||
for (let artifact of artifacts) { | ||
const artifactPath = path.join(ARTIFACTS_PATH, artifact); | ||
const data = await fs.readFile(artifactPath); | ||
|
||
await github.rest.repos.uploadReleaseAsset({ | ||
owner, | ||
repo, | ||
release_id: res.data.id, | ||
name: artifact, | ||
data | ||
}); | ||
} | ||
} | ||
|
||
module.exports = createRelease; |