Initial commit #3
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build FFmpeg (Windows) | |
| # Builds FFmpeg as shared MSVC DLLs on a Windows runner and uploads the headers | |
| # + import libraries + DLLs as zip artifacts -- the same zips the Docker image | |
| # produces, ready to publish to a CDN for mod_av to consume. | |
| # | |
| # The runner builds natively (VS is preinstalled; MSYS2 ships at C:\msys64 and is | |
| # used only as the configure/make driver). Trigger manually, or push a tag like | |
| # `ffmpeg-v7.1.5` to build + attach a Release. | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| ffmpeg_version: | |
| description: 'FFmpeg version to build (e.g. 7.1.5)' | |
| required: true | |
| default: '7.1.5' | |
| configs: | |
| description: 'Configurations to build (space-separated)' | |
| required: true | |
| default: 'Release Debug' | |
| push: | |
| tags: | |
| - 'ffmpeg-v*' # e.g. push tag `ffmpeg-v7.1.5` | |
| jobs: | |
| build: | |
| runs-on: windows-2022 | |
| timeout-minutes: 180 | |
| permissions: | |
| contents: write # attach zips to a Release on tag push | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| variant: [openh264, x264] # both variants build in parallel (separate runners) | |
| env: | |
| DEPS_PREFIX: ${{ github.workspace }}\deps | |
| MSYS2_ROOT: C:\msys64 | |
| steps: | |
| - name: Checkout builder | |
| uses: actions/checkout@v4 | |
| - name: Resolve build parameters | |
| id: p | |
| shell: pwsh | |
| run: | | |
| if ($env:GITHUB_EVENT_NAME -eq 'push') { | |
| $fv = "$env:GITHUB_REF_NAME" -replace '^ffmpeg-v', '' | |
| $cfg = 'Release Debug' | |
| } else { | |
| $fv = '${{ inputs.ffmpeg_version }}' | |
| $cfg = '${{ inputs.configs }}' | |
| } | |
| "ffmpeg_version=$fv" >> $env:GITHUB_OUTPUT | |
| "configs=$cfg" >> $env:GITHUB_OUTPUT | |
| Write-Host "Building FFmpeg $fv [$cfg] variant=${{ matrix.variant }}" | |
| - name: Install NASM | |
| shell: pwsh | |
| run: choco install -y --no-progress nasm | |
| - name: Install MSYS2 driver packages | |
| shell: pwsh | |
| run: | | |
| & C:\msys64\usr\bin\bash.exe -lc 'pacman -Sy --noconfirm' | |
| & C:\msys64\usr\bin\bash.exe -lc 'pacman -S --noconfirm --needed make automake diffutils pkgconf tar xz' | |
| - name: Build codec dependencies (${{ matrix.variant }}) | |
| shell: pwsh | |
| run: .\build-deps.ps1 -Deps '${{ matrix.variant }}' | |
| - name: Build FFmpeg + package zips | |
| shell: pwsh | |
| env: | |
| FFMPEG_VERSION: ${{ steps.p.outputs.ffmpeg_version }} | |
| CONFIGS: ${{ steps.p.outputs.configs }} | |
| ARCH: x64 | |
| VARIANT: ${{ matrix.variant }} | |
| OUT_DIR: ${{ github.workspace }}\artifacts | |
| run: .\build-ffmpeg.ps1 | |
| - name: List artifacts | |
| shell: pwsh | |
| run: Get-ChildItem '${{ github.workspace }}\artifacts' | Format-Table Name, Length | |
| - name: Upload zips | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ffmpeg-${{ steps.p.outputs.ffmpeg_version }}-${{ matrix.variant }}-x64 | |
| path: | | |
| artifacts/*.zip | |
| artifacts/SHA256SUMS.txt | |
| if-no-files-found: error | |
| retention-days: 30 | |
| # Tag push only: gather both variants' artifacts, regenerate one combined | |
| # SHA256SUMS over the full set (the matrix legs each wrote a partial one, and | |
| # both produce an identical headers.zip), and attach everything to the Release. | |
| release: | |
| if: github.event_name == 'push' | |
| needs: build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Download all variant artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: dl | |
| pattern: ffmpeg-*-x64 | |
| merge-multiple: true # merge both legs into one dir (headers.zip dedups by name) | |
| - name: Regenerate combined SHA256SUMS | |
| shell: bash | |
| run: | | |
| cd dl | |
| rm -f SHA256SUMS.txt | |
| sha256sum *.zip > SHA256SUMS.txt | |
| echo "=== release assets ==="; ls -l | |
| - name: Publish to Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: | | |
| dl/*.zip | |
| dl/SHA256SUMS.txt |