Skip to content

Build FFmpeg on push #31

Build FFmpeg on push

Build FFmpeg on push #31

name: Build FFmpeg on push
on:
push:
paths:
- ffmpeg-windows-build-helpers
- dependencies.sh
- .github/workflows/build-on-push.yaml
branches-ignore:
- dependabot/**
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
os: [win64, win32]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
persist-credentials: false
- name: Install dependencies
run: ./dependencies.sh
- name: Get current ffmpeg-windows-build-helpers git commit SHA
id: helper-git-sha
working-directory: ffmpeg-windows-build-helpers
run: echo git-sha=$(git rev-parse --short HEAD) >> $GITHUB_OUTPUT
- name: Move ffmpeg-windows-build-helpers
run: mv -v ./ffmpeg-windows-build-helpers/* ./
- name: Get current date & time before build
id: date-time-before
run: echo date-time=$(date +'%Y-%m-%d %H:%M') >> $GITHUB_OUTPUT
- name: Compile FFmpeg using ffmpeg-windows-build-helpers
run: ./cross_compile_ffmpeg.sh --ffmpeg-git-checkout-version=${{ vars.FFMPEG_VERSION }} --gcc-cpu-count=$(nproc) --disable-nonfree=n --sandbox-ok=y --compiler-flavors=${{ matrix.os }}
- name: Get current date & time after build
id: date-time-after
run: |
echo date-time=$(date +'%Y-%m-%d %H:%M') >> $GITHUB_OUTPUT
echo date-time-tag=$(date +'%Y-%m-%d-%H-%M') >> $GITHUB_OUTPUT
- name: Upload FFmpeg ${{ matrix.os }} nonfree
uses: actions/upload-artifact@v3
with:
name: ffmpeg-${{ vars.FFMPEG_VERSION }}-${{ steps.helper-git-sha.outputs.git-sha }}-${{ matrix.os }}-nonfree
path: sandbox/${{ matrix.os }}/ffmpeg_git_with_fdk_aac_${{ vars.FFMPEG_VERSION }}/ffmpeg.exe
- name: Upload FFprobe ${{ matrix.os }} nonfree
uses: actions/upload-artifact@v3
with:
name: ffprobe-${{ vars.FFMPEG_VERSION }}-${{ steps.helper-git-sha.outputs.git-sha }}-${{ matrix.os }}-nonfree
path: sandbox/${{ matrix.os }}/ffmpeg_git_with_fdk_aac_${{ vars.FFMPEG_VERSION }}/ffprobe.exe
- name: Upload FFplay ${{ matrix.os }} nonfree
uses: actions/upload-artifact@v3
with:
name: ffplay-${{ vars.FFMPEG_VERSION }}-${{ steps.helper-git-sha.outputs.git-sha }}-${{ matrix.os }}-nonfree
path: sandbox/${{ matrix.os }}/ffmpeg_git_with_fdk_aac_${{ vars.FFMPEG_VERSION }}/ffplay.exe
outputs:
date-time-before: ${{ steps.date-time-before.outputs.date-time }}
date-time-after: ${{ steps.date-time-after.outputs.date-time }}
date-time-after-tag: ${{ steps.date-time-after.outputs.date-time-tag }}
helper-git-sha: ${{ steps.helper-git-sha.outputs.git-sha }}
archive:
needs: build
runs-on: ubuntu-latest
strategy:
matrix:
os: [win64, win32]
steps:
- name: Download FFmpeg ${{ matrix.os }} nonfree
uses: actions/download-artifact@v3
with:
name: ffmpeg-${{ vars.FFMPEG_VERSION }}-${{ needs.build.outputs.helper-git-sha }}-${{ matrix.os }}-nonfree
- name: Download FFprobe ${{ matrix.os }} nonfree
uses: actions/download-artifact@v3
with:
name: ffprobe-${{ vars.FFMPEG_VERSION }}-${{ needs.build.outputs.helper-git-sha }}-${{ matrix.os }}-nonfree
- name: Download FFplay ${{ matrix.os }} nonfree
uses: actions/download-artifact@v3
with:
name: ffplay-${{ vars.FFMPEG_VERSION }}-${{ needs.build.outputs.helper-git-sha }}-${{ matrix.os }}-nonfree
- name: 7-Zip FFmpeg ${{ matrix.os }} nonfree
run: 7z a ffmpeg-${{ vars.FFMPEG_VERSION }}-${{ needs.build.outputs.helper-git-sha }}-${{ matrix.os }}-nonfree.7z ffmpeg.exe ffprobe.exe ffplay.exe -mx9
- name: Upload FFmpeg archive ${{ matrix.os }} nonfree
uses: actions/upload-artifact@v3
with:
name: ffmpeg-archive-${{ vars.FFMPEG_VERSION }}-${{ needs.build.outputs.helper-git-sha }}-${{ matrix.os }}-nonfree
path: ffmpeg-${{ vars.FFMPEG_VERSION }}-${{ needs.build.outputs.helper-git-sha }}-${{ matrix.os }}-nonfree.7z
release:
needs: [build, archive]
runs-on: ubuntu-latest
steps:
- name: Download FFmpeg archive win64
uses: actions/download-artifact@v3
with:
name: ffmpeg-archive-${{ vars.FFMPEG_VERSION }}-${{ needs.build.outputs.helper-git-sha }}-win64-nonfree
- name: Download FFmpeg archive win32
uses: actions/download-artifact@v3
with:
name: ffmpeg-archive-${{ vars.FFMPEG_VERSION }}-${{ needs.build.outputs.helper-git-sha }}-win32-nonfree
- name: Release
run: |
gh release create "m-${{ needs.build.outputs.date-time-after-tag }}" \
"ffmpeg-${{ vars.FFMPEG_VERSION }}-${{ needs.build.outputs.helper-git-sha }}-win64-nonfree.7z" \
"ffmpeg-${{ vars.FFMPEG_VERSION }}-${{ needs.build.outputs.helper-git-sha }}-win32-nonfree.7z" \
-n "FFmpeg nonfree ${{ vars.FFMPEG_VERSION }} built on ${{ needs.build.outputs.date-time-after }} started at ${{ needs.build.outputs.date-time-before }}
Using ffmpeg-windows-build-helpers git-${{ needs.build.outputs.helper-git-sha }}" \
-t "${{ vars.FFMPEG_VERSION }} ${{ needs.build.outputs.date-time-after }} ${{ needs.build.outputs.helper-git-sha }}"
env:
GITHUB_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
delete_old:
name: Delete older pre-releases
runs-on: ubuntu-latest
steps:
- name: Delete older pre-releases
uses: dev-drprasad/delete-older-releases@v0.3.2
with:
keep_latest: 1
delete_tags: true
delete_tag_pattern: a
env:
GITHUB_TOKEN: ${{ github.token }}