Skip to content

Commit

Permalink
generate and show binary checksums in releases (#4012) (#4095)
Browse files Browse the repository at this point in the history
  • Loading branch information
aler9 authored Jan 2, 2025
1 parent b49acb1 commit fc803da
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/nightly_binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ jobs:
fetch-depth: 0

- run: make binaries
env:
CHECKSUM: '1'

- uses: actions/upload-artifact@v4
with:
Expand Down
15 changes: 15 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ jobs:
- uses: actions/checkout@v4

- run: make binaries
env:
CHECKSUM: '1'

- uses: actions/upload-artifact@v4
with:
Expand All @@ -38,11 +40,24 @@ jobs:
const currentRelease = context.ref.split('/')[2];
let body = `## Security\n\n`
+ `Binaries have been produced by the [Release workflow](https://github.com/${owner}/${repo}/actions/workflows/release.yml)`
+ ` without human intervention.\n\n`
+ `SHA256 checksums:\n`;
for (const name of await fs.readdir('./binaries/')) {
if (name.endsWith('.sha256sum')) {
const parts = (await fs.readFile(`./binaries/${name}`, 'utf-8')).slice(0, -1).split(' ');
body += `* ${parts[2]} ${parts[0]}\n`;
}
}
const res = await github.rest.repos.createRelease({
owner,
repo,
tag_name: currentRelease,
name: currentRelease,
body,
});
const release_id = res.data.id;
Expand Down
7 changes: 7 additions & 0 deletions scripts/binaries.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
BINARY_NAME = mediamtx

ifeq ($(CHECKSUM),1)
define DOCKERFILE_CHECKSUM
RUN cd /s/binaries; for f in *; do sha256sum $$f > $$f.sha256sum; done
endef
endif

define DOCKERFILE_BINARIES
FROM $(BASE_IMAGE) AS build-base
RUN apk add --no-cache zip make git tar
Expand Down Expand Up @@ -56,6 +62,7 @@ COPY --from=build-darwin-arm64 /s/binaries /s/binaries
COPY --from=build-linux-armv6 /s/binaries /s/binaries
COPY --from=build-linux-armv7 /s/binaries /s/binaries
COPY --from=build-linux-arm64 /s/binaries /s/binaries
$(DOCKERFILE_CHECKSUM)
endef
export DOCKERFILE_BINARIES

Expand Down

0 comments on commit fc803da

Please sign in to comment.