Skip to content

Commit 77ecb84

Browse files
committed
checksums uploaad
Signed-off-by: Rajat Jindal <[email protected]>
1 parent a7083c3 commit 77ecb84

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

dist/index.js

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/release.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,23 @@ async function run(): Promise<void> {
9090

9191
core.debug(JSON.stringify(releaseReq, null, '\t'))
9292

93+
// create checksums-<tagname>.txt
94+
if (core.getBooleanInput('upload_checksums', {trimWhitespace: true})) {
95+
const checksums: string[] = []
96+
for (const pair of releaseMap) {
97+
const [key, value] = pair
98+
checksums.push(`${value} ${getFilename(key)}`)
99+
}
100+
101+
await octokit.rest.repos.uploadReleaseAsset({
102+
owner: github.context.repo.owner,
103+
repo: github.context.repo.repo,
104+
release_id: release.id,
105+
name: `checksums-${tagName}.txt`,
106+
data: checksums.join('\n')
107+
})
108+
}
109+
93110
if (tagName === 'canary') {
94111
core.info('uploading asset to canary release')
95112
await octokit.rest.repos.uploadReleaseAsset({
@@ -139,4 +156,8 @@ function getReleaseTagName(): string {
139156
throw new Error(`invalid ref '${github.context.ref}' found`)
140157
}
141158

159+
function getFilename(url: string): string {
160+
return url
161+
}
162+
142163
run()

0 commit comments

Comments
 (0)