Skip to content

Commit

Permalink
copy checksums together with file
Browse files Browse the repository at this point in the history
  • Loading branch information
petar committed Dec 6, 2021
1 parent 23bcc58 commit 6ca46fb
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions .github/workflows/sync-release-assets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ jobs:
for (const file of missing_files) {
hash_sha = file + ".sha512"
hash_cid = file + ".cid"
// if didt.ipfs.io does not have both hash checksums for the file, skip this file
// if dist.ipfs.io does not have both hash checksums for the file, skip this file
if (!dist_assets_map[hash_sha] || !dist_assets_map[hash_cid]) {
console.log("skipping", file, "as dist.ipfs.io does not provide a checksum")
continue
Expand All @@ -131,19 +131,34 @@ jobs:
await exec.exec('sha512sum', [file], sha_options)
// read expected sha512 output
const sha_data = await fs.readFile(hash_sha, "binary")
const cid_data = await fs.readFile(hash_cid, "binary")
if (sha_data != sha_stdout) {
throw "checksum verification failed for " + file
}
console.log("uploading", file, "to github release", release.tag_name)
const data = await fs.readFile(file, "binary")
resp = await github.repos.uploadReleaseAsset({
await github.repos.uploadReleaseAsset({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: release.id,
name: file,
data: data,
})
await github.repos.uploadReleaseAsset({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: release.id,
name: hash_sha,
data: sha_data,
})
await github.repos.uploadReleaseAsset({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: release.id,
name: hash_cid,
data: cid_data,
})
}
// summary of assets on both sides
release_assets.push({ tag: release.tag_name, github_assets: github_assets, dist_assets: dist_assets_list })
Expand Down

0 comments on commit 6ca46fb

Please sign in to comment.