Skip to content

Commit 6f99e30

Browse files
committed
Build the exe on a runner with build provenance
The 1.1.0 exe was built on my machine and the only thing backing it was a sha256 I pasted into the release notes by hand. That is worth about as much as my word. A windows-latest job that builds it, smoke tests it against the real telecine fixture in a directory with no Python and no source tree, and runs actions/attest-build-provenance gives anyone a chain from the tag to the binary they can check with gh attestation verify. README now says what the unsigned exe looks like on first run, because the people most likely to download it are the ones least likely to have seen that blue box before and shrugged at it.
1 parent e603080 commit 6f99e30

2 files changed

Lines changed: 89 additions & 0 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: release
2+
3+
on:
4+
push:
5+
tags: ["v*"]
6+
workflow_dispatch:
7+
inputs:
8+
ref:
9+
description: Tag to build
10+
required: true
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
exe:
17+
runs-on: windows-latest
18+
permissions:
19+
contents: write
20+
id-token: write
21+
attestations: write
22+
steps:
23+
- uses: actions/checkout@v4
24+
with:
25+
ref: ${{ inputs.ref || github.ref }}
26+
- uses: actions/setup-python@v5
27+
with:
28+
python-version: "3.11"
29+
- run: pip install -e ".[dev]"
30+
- run: pyinstaller --clean --noconfirm scanverdict.spec
31+
32+
- run: choco install ffmpeg -y --no-progress
33+
34+
# The exe has to work on a machine with no Python and no source tree, so
35+
# run it from a directory that has neither.
36+
- name: Run the built exe
37+
shell: bash
38+
run: |
39+
python tests/make_fixtures.py "$RUNNER_TEMP/fixtures"
40+
mkdir -p "$RUNNER_TEMP/smoke"
41+
cp dist/scanverdict.exe "$RUNNER_TEMP/fixtures/telecine.mkv" "$RUNNER_TEMP/smoke/"
42+
cd "$RUNNER_TEMP/smoke"
43+
./scanverdict.exe --version
44+
./scanverdict.exe telecine.mkv | tee out.txt
45+
grep -q "verdict: telecine_3_2" out.txt
46+
grep -q "verified:" out.txt
47+
./scanverdict.exe missing.mkv && exit 1 || test $? -eq 1
48+
49+
- name: Checksum
50+
shell: bash
51+
run: sha256sum dist/scanverdict.exe | tee dist/scanverdict.exe.sha256
52+
53+
# Ties this exact binary to this workflow run and this commit. `gh
54+
# attestation verify` checks it without anyone trusting the build machine.
55+
- uses: actions/attest-build-provenance@v2
56+
with:
57+
subject-path: dist/scanverdict.exe
58+
59+
- uses: actions/upload-artifact@v4
60+
with:
61+
name: scanverdict-exe
62+
path: |
63+
dist/scanverdict.exe
64+
dist/scanverdict.exe.sha256
65+
66+
- name: Attach to the release
67+
if: startsWith(github.ref, 'refs/tags/v') || inputs.ref != ''
68+
shell: bash
69+
env:
70+
GH_TOKEN: ${{ github.token }}
71+
run: |
72+
tag="${{ inputs.ref || github.ref_name }}"
73+
gh release upload "$tag" dist/scanverdict.exe dist/scanverdict.exe.sha256 \
74+
--clobber --repo "$GITHUB_REPOSITORY"

‎README.md‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,21 @@ If you would rather not have Python at all, grab `scanverdict.exe` from the
3131
[releases page](https://github.com/Booyaka101/scanverdict/releases) and run it from a
3232
command prompt. One file, no installer.
3333

34+
The exe is not code signed, so the first time you run it Windows shows a blue "Windows
35+
protected your PC" box with only a Don't run button. Click **More info** and then **Run
36+
anyway**. A signing certificate costs a few hundred a year and this is a free tool, so
37+
that box is not going away. What you can check instead is where the binary came from:
38+
every exe from v1.1.1 on is built by GitHub Actions and carries a build attestation tying
39+
it to the workflow run and the commit, which you can verify yourself with
40+
[gh](https://cli.github.com/):
41+
42+
```
43+
gh attestation verify scanverdict.exe --repo Booyaka101/scanverdict
44+
```
45+
46+
That is a stronger claim than a checksum I paste in by hand, because I never touch the
47+
binary.
48+
3449
**You need ffmpeg and ffprobe on PATH.** All decoding happens through them. Windows builds
3550
are at [gyan.dev](https://www.gyan.dev/ffmpeg/builds/); on macOS `brew install ffmpeg`, on
3651
Debian and Ubuntu `apt install ffmpeg`. If they are missing, scanverdict says so and exits

0 commit comments

Comments
 (0)