Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/scripts/codec-checksums.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env bash
# Rewrite linux/Dockerfile's <LIB>_SHA256 for each <LIB>_VERSION that differs from <base-ref>; prints what changed.
# Unchanged versions are never re-hashed, so a tarball swapped upstream still fails the build's sha256sum -c.
set -euo pipefail

dockerfile=linux/Dockerfile
base=${1:?usage: codec-checksums.sh <base-ref>}
base_file=$(git show "${base}:${dockerfile}")

while IFS='=' read -r var ver; do
lib=${var%_VERSION}
grep -q "^ARG ${lib}_SHA256=" "$dockerfile" || continue
old=$(sed -n "s/^ARG ${var}=//p" <<<"$base_file")
[ "$ver" = "$old" ] && continue

template=$(grep -oE "https://[^\"]*\\\$\\{${var}\\}[^\"]*" "$dockerfile" | head -1 || true)
if [ -z "$template" ]; then
echo "::error::no download URL in ${dockerfile} uses \${${var}}" >&2
exit 1
fi
url=${template//"\${${var}}"/$ver}
sha=$(curl -fsSL --retry 3 "$url" | sha256sum | cut -d' ' -f1)

sed "s/^ARG ${lib}_SHA256=.*/ARG ${lib}_SHA256=${sha}/" "$dockerfile" > "${dockerfile}.tmp"
mv "${dockerfile}.tmp" "$dockerfile"
echo "${lib} ${old:-unset} -> ${ver}"
done < <(sed -n 's/^ARG \([A-Z0-9_]*_VERSION\)=\(.*\)$/\1=\2/p' "$dockerfile")
61 changes: 61 additions & 0 deletions .github/workflows/codec-checksums.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Codec checksums

# Renovate bumps a codec *_VERSION in linux/Dockerfile but can't recompute its *_SHA256; this commits it to the PR.
on:
pull_request:
branches: [main]
paths: ['linux/Dockerfile']

permissions:
contents: read

jobs:
checksums:
# Same-repo Renovate branches only; a fork PR's token can't push, and nothing else should be rewritten.
if: startsWith(github.head_ref, 'renovate/') && github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
permissions:
contents: write # push the checksum commit
actions: write # re-run the required checks on it
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.head_ref }}
fetch-depth: 0

- name: Recompute checksums for changed versions
id: sums
env:
BASE_REF: ${{ github.base_ref }}
run: |
set -euo pipefail
updated=$(.github/scripts/codec-checksums.sh "origin/${BASE_REF}")
# Decide on the file, not the output: a PR whose checksums are already right reports versions but changes nothing.
if git diff --quiet -- linux/Dockerfile; then
echo "No checksum to update.${updated:+ Versions already current: $updated}"
echo "changed=false" >> "$GITHUB_OUTPUT"
exit 0
fi
echo "$updated"
{
echo "changed=true"
echo "summary<<EOF"
echo "$updated"
echo "EOF"
} >> "$GITHUB_OUTPUT"

# A push made with GITHUB_TOKEN starts no workflow, so the required checks are dispatched by hand.
- name: Commit and re-run the required checks
if: steps.sums.outputs.changed == 'true'
env:
GH_TOKEN: ${{ github.token }}
HEAD_REF: ${{ github.head_ref }}
SUMMARY: ${{ steps.sums.outputs.summary }}
run: |
set -euo pipefail
git config user.name 'github-actions[bot]'
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
git commit -q -am "chore(deps): update codec checksums" -m "$SUMMARY"
git push origin "HEAD:${HEAD_REF}"
gh workflow run mirror.yml --ref "$HEAD_REF"
gh workflow run codeql.yml --ref "$HEAD_REF"
1 change: 1 addition & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:
branches: [ "main" ]
schedule:
- cron: '27 3 * * 1'
workflow_dispatch:

permissions:
contents: read
Expand Down
6 changes: 6 additions & 0 deletions linux/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,16 @@ ARG FFMPEG_TAG=n8.1.2
# and the build proceeds — auto-updates above n8.1.2 keep flowing.
ARG FFMPEG_COMMIT=38b88335f99e76ed89ff3c93f877fdefce736c13
ARG FFMPEG_COMMIT_TAG=n8.1.2
# Renovate bumps these; codec-checksums.yml then rewrites the matching *_SHA256 below.
# renovate: datasource=repology depName=alpine_edge/lame versioning=loose extractVersion=^(?<version>[^-]+)
ARG LAME_VERSION=3.100
# renovate: datasource=github-tags depName=xiph/ogg extractVersion=^v(?<version>\d+\.\d+(?:\.\d+)?)$
ARG OGG_VERSION=1.3.5
# renovate: datasource=github-tags depName=xiph/vorbis extractVersion=^v(?<version>\d+\.\d+(?:\.\d+)?)$
ARG VORBIS_VERSION=1.3.7
# renovate: datasource=github-tags depName=xiph/opus extractVersion=^v(?<version>\d+\.\d+(?:\.\d+)?)$
ARG OPUS_VERSION=1.5.2
# renovate: datasource=repology depName=alpine_edge/opencore-amr versioning=loose extractVersion=^(?<version>[^-]+)
ARG OPENCORE_AMR_VERSION=0.1.6

# SHA-256 of each source tarball (verified before building).
Expand Down
3 changes: 2 additions & 1 deletion renovate.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["github>chodeus/chodeus-ops"]
"extends": ["github>chodeus/chodeus-ops"],
"gitIgnoredAuthors": ["41898282+github-actions[bot]@users.noreply.github.com"]
}
Loading