Skip to content

Commit 04b4886

Browse files
committed
feat: Add workflow dispatch options for testing and bootstrapping, and add artifact attestation
1 parent df8174e commit 04b4886

File tree

1 file changed

+35
-8
lines changed

1 file changed

+35
-8
lines changed

.github/workflows/build-ffmpeg.yaml

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,16 @@ on:
33
schedule:
44
- cron: '7 11 * * 0'
55
workflow_dispatch:
6+
inputs:
7+
force_build:
8+
description: Disable checking for newer commit
9+
type: boolean
10+
no_release:
11+
description: Don't create release
12+
type: boolean
13+
use_own_fork:
14+
description: Use own ffmpeg-windows-build-helpers fork
15+
type: boolean
616
watch:
717
types: [started]
818

@@ -19,10 +29,12 @@ jobs:
1929
version=$(curl -s https://endoflife.date/api/ffmpeg.json | jq -r .[0].latest)
2030
echo version=${version%.0} >> $GITHUB_OUTPUT
2131
22-
- name: Get ffmpeg-windows-build-helpers latest commit
32+
- name: Get ${{ inputs.use_own_fork && github.repository_owner || 'rdp' }}/ffmpeg-windows-build-helpers latest commit
2333
id: ffmpeg-helper-info
2434
run: |
25-
git_sha=$(gh api repos/rdp/ffmpeg-windows-build-helpers/commits/master -q .sha)
35+
git_owner=${{ inputs.use_own_fork && github.repository_owner || 'rdp' }}
36+
git_sha=$(gh api repos/$git_owner/ffmpeg-windows-build-helpers/commits/master -q .sha)
37+
echo git-owner=$git_owner >> $GITHUB_OUTPUT
2638
echo git-sha=$git_sha >> $GITHUB_OUTPUT
2739
echo git-sha-short=${git_sha::7} >> $GITHUB_OUTPUT
2840
env:
@@ -38,12 +50,14 @@ jobs:
3850
GITHUB_TOKEN: ${{ github.token }}
3951

4052
- name: Check if there is newer version or commit
53+
if: '! inputs.force_build'
4154
run: >
4255
[[ "${{ steps.ffmpeg-info.outputs.version }}" != "${{ steps.ffmpeg-autobuild-info.outputs.version }}" ]] ||
4356
[[ "${{ steps.ffmpeg-helper-info.outputs.git-sha-short }}" != "${{ steps.ffmpeg-autobuild-info.outputs.helper-git-sha }}" ]]
4457
4558
outputs:
4659
version: ${{ steps.ffmpeg-info.outputs.version }}
60+
helper-git-owner: ${{ steps.ffmpeg-helper-info.outputs.git-owner }}
4761
helper-git-sha: ${{ steps.ffmpeg-helper-info.outputs.git-sha }}
4862
helper-git-sha-short: ${{ steps.ffmpeg-helper-info.outputs.git-sha-short }}
4963

@@ -55,10 +69,10 @@ jobs:
5569
os: [win64, win32]
5670

5771
steps:
58-
- name: Checkout ffmpeg-windows-build-helpers
72+
- name: Checkout ${{ needs.check.outputs.helper-git-owner }}/ffmpeg-windows-build-helpers
5973
uses: actions/checkout@v4
6074
with:
61-
repository: rdp/ffmpeg-windows-build-helpers
75+
repository: ${{ needs.check.outputs.helper-git-owner }}/ffmpeg-windows-build-helpers
6276
ref: ${{ needs.check.outputs.helper-git-sha }}
6377
persist-credentials: false
6478

@@ -74,7 +88,7 @@ jobs:
7488
id: date-time-before
7589
run: echo date-time=$(date +'%Y-%m-%d %H:%M') >> $GITHUB_OUTPUT
7690

77-
- name: Compile FFmpeg using ffmpeg-windows-build-helpers
91+
- name: Compile FFmpeg ${{ needs.check.outputs.version }} using ffmpeg-windows-build-helpers ${{ needs.check.outputs.helper-git-sha-short }}
7892
run: ./cross_compile_ffmpeg.sh --ffmpeg-git-checkout-version=n${{ needs.check.outputs.version }} --gcc-cpu-count=$(nproc) --disable-nonfree=n --sandbox-ok=y --compiler-flavors=${{ matrix.os }}
7993

8094
- name: Get current date & time after build
@@ -92,7 +106,7 @@ jobs:
92106
sandbox/${{ matrix.os }}/ffmpeg_git_with_fdk_aac_n${{ needs.check.outputs.version }}/ffprobe.exe
93107
sandbox/${{ matrix.os }}/ffmpeg_git_with_fdk_aac_n${{ needs.check.outputs.version }}/ffplay.exe
94108
if-no-files-found: error
95-
retention-days: 1
109+
retention-days: ${{ inputs.no_release && '0' || '1' }}
96110

97111
outputs:
98112
date-time-before: ${{ steps.date-time-before.outputs.date-time }}
@@ -117,19 +131,32 @@ jobs:
117131
echo "This version of ffmpeg has nonfree parts compiled in." >> LICENSE
118132
echo "Therefore it is not legally redistributable." >> LICENSE
119133
134+
- name: Generate artifact attestation for FFmpeg binaries
135+
if: '! inputs.no_release'
136+
uses: actions/attest-build-provenance@v1
137+
with:
138+
subject-path: ff*.exe
139+
120140
- name: 7-Zip FFmpeg binaries
121141
run: 7z a -mx9 ffmpeg-${{ needs.check.outputs.version }}-${{ needs.check.outputs.helper-git-sha-short }}-${{ matrix.os }}-nonfree.7z ff{mpeg,probe,play}.exe LICENSE
122142

143+
- name: Generate artifact attestation for FFmpeg archive
144+
if: '! inputs.no_release'
145+
uses: actions/attest-build-provenance@v1
146+
with:
147+
subject-path: ffmpeg-${{ needs.check.outputs.version }}-${{ needs.check.outputs.helper-git-sha-short }}-${{ matrix.os }}-nonfree.7z
148+
123149
- name: Upload FFmpeg archive
124150
uses: actions/upload-artifact@v4
125151
with:
126152
name: ffmpeg-archive-${{ matrix.os }}
127153
path: ffmpeg-${{ needs.check.outputs.version }}-${{ needs.check.outputs.helper-git-sha-short }}-${{ matrix.os }}-nonfree.7z
128-
retention-days: 1
154+
retention-days: ${{ inputs.no_release && '0' || '1' }}
129155
compression-level: 0
130156

131157
release:
132158
needs: [check, build, archive]
159+
if: '! inputs.no_release'
133160
runs-on: ubuntu-latest
134161
steps:
135162
- name: Download FFmpeg archives
@@ -143,7 +170,7 @@ jobs:
143170
gh release create "${{ needs.build.outputs.date-time-after-tag }}-${{ needs.check.outputs.helper-git-sha-short }}-${{ needs.check.outputs.version }}" \
144171
ffmpeg-${{ needs.check.outputs.version }}-${{ needs.check.outputs.helper-git-sha-short }}-{win64,win32}-nonfree.7z \
145172
-n "FFmpeg nonfree ${{ needs.check.outputs.version }} built on ${{ needs.build.outputs.date-time-after }} started at ${{ needs.build.outputs.date-time-before }}
146-
Using ffmpeg-windows-build-helpers git-${{ needs.check.outputs.helper-git-sha }}" \
173+
Using ${{ needs.check.outputs.helper-git-owner }}/ffmpeg-windows-build-helpers git-${{ needs.check.outputs.helper-git-sha }}" \
147174
-t "${{ needs.check.outputs.version }} ${{ needs.build.outputs.date-time-after }} ${{ needs.build.outputs.helper-git-sha }}"
148175
env:
149176
GITHUB_TOKEN: ${{ github.token }}

0 commit comments

Comments
 (0)