Skip to content

Commit fc803da

Browse files
authored
generate and show binary checksums in releases (#4012) (#4095)
1 parent b49acb1 commit fc803da

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

.github/workflows/nightly_binaries.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ jobs:
1313
fetch-depth: 0
1414

1515
- run: make binaries
16+
env:
17+
CHECKSUM: '1'
1618

1719
- uses: actions/upload-artifact@v4
1820
with:

.github/workflows/release.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ jobs:
1313
- uses: actions/checkout@v4
1414

1515
- run: make binaries
16+
env:
17+
CHECKSUM: '1'
1618

1719
- uses: actions/upload-artifact@v4
1820
with:
@@ -38,11 +40,24 @@ jobs:
3840
3941
const currentRelease = context.ref.split('/')[2];
4042
43+
let body = `## Security\n\n`
44+
+ `Binaries have been produced by the [Release workflow](https://github.com/${owner}/${repo}/actions/workflows/release.yml)`
45+
+ ` without human intervention.\n\n`
46+
+ `SHA256 checksums:\n`;
47+
48+
for (const name of await fs.readdir('./binaries/')) {
49+
if (name.endsWith('.sha256sum')) {
50+
const parts = (await fs.readFile(`./binaries/${name}`, 'utf-8')).slice(0, -1).split(' ');
51+
body += `* ${parts[2]} ${parts[0]}\n`;
52+
}
53+
}
54+
4155
const res = await github.rest.repos.createRelease({
4256
owner,
4357
repo,
4458
tag_name: currentRelease,
4559
name: currentRelease,
60+
body,
4661
});
4762
const release_id = res.data.id;
4863

scripts/binaries.mk

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
BINARY_NAME = mediamtx
22

3+
ifeq ($(CHECKSUM),1)
4+
define DOCKERFILE_CHECKSUM
5+
RUN cd /s/binaries; for f in *; do sha256sum $$f > $$f.sha256sum; done
6+
endef
7+
endif
8+
39
define DOCKERFILE_BINARIES
410
FROM $(BASE_IMAGE) AS build-base
511
RUN apk add --no-cache zip make git tar
@@ -56,6 +62,7 @@ COPY --from=build-darwin-arm64 /s/binaries /s/binaries
5662
COPY --from=build-linux-armv6 /s/binaries /s/binaries
5763
COPY --from=build-linux-armv7 /s/binaries /s/binaries
5864
COPY --from=build-linux-arm64 /s/binaries /s/binaries
65+
$(DOCKERFILE_CHECKSUM)
5966
endef
6067
export DOCKERFILE_BINARIES
6168

0 commit comments

Comments
 (0)