FFmpeg-Builds/.github/workflows/build.yml

214 lines
7.5 KiB
YAML
Raw Normal View History

2020-09-03 00:15:17 +00:00
name: Build FFmpeg
2020-09-03 17:20:10 +00:00
on:
push:
paths-ignore:
- '**.md'
- 'LICENSE'
2022-02-15 17:10:39 +00:00
workflow_dispatch:
inputs:
doRelease:
description: 'Publish new release'
type: boolean
default: false
required: false
buildOnly:
description: 'Only build ffmpeg'
type: boolean
default: false
required: false
2020-09-03 17:20:10 +00:00
schedule:
- cron: '0 12 * * *'
2020-09-03 00:15:17 +00:00
2021-04-05 16:46:32 +00:00
env:
DOCKER_BUILDKIT: 1
2020-09-03 00:15:17 +00:00
jobs:
build_base:
name: Build base image
if: ${{ github.event.inputs.buildOnly != 'true' }}
2020-09-03 00:15:17 +00:00
runs-on: ubuntu-latest
steps:
- name: Checkout
2022-05-06 16:04:02 +00:00
uses: actions/checkout@v3
- name: Install buildx
2022-05-06 16:04:02 +00:00
uses: docker/setup-buildx-action@v2
with:
config: .github/buildkit.toml
- name: Login to Docker
2022-05-06 16:04:02 +00:00
uses: docker/login-action@v2
2020-09-03 00:15:17 +00:00
with:
2021-04-05 17:51:41 +00:00
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
2020-09-27 21:46:53 +00:00
- name: Image Name
id: imagename
2022-10-23 00:51:12 +00:00
run: echo "name=ghcr.io/${GITHUB_REPOSITORY,,}/base" >> $GITHUB_OUTPUT
- name: Stop Commands
run: T="$(echo -n ${{ github.token }} | sha256sum | head -c 64)" && echo -e "::add-mask::${T}\n::stop-commands::${T}"
- name: Build target base image
2022-05-06 16:04:02 +00:00
uses: docker/build-push-action@v3
with:
context: images/base
pull: true
push: true
2021-11-13 18:16:18 +00:00
tags: ${{ steps.imagename.outputs.name }}:latest
cache-to: type=registry,mode=max,ref=${{ steps.imagename.outputs.name }}:cache
cache-from: type=registry,ref=${{ steps.imagename.outputs.name }}:cache
2020-09-03 00:15:17 +00:00
build_target_bases:
2020-09-03 12:41:26 +00:00
name: Build target base image
if: ${{ github.event.inputs.buildOnly != 'true' }}
2020-09-03 00:15:17 +00:00
needs: build_base
runs-on: ubuntu-latest
strategy:
2020-09-06 02:08:17 +00:00
fail-fast: false
2020-09-03 00:15:17 +00:00
matrix:
2022-07-06 15:00:37 +00:00
target: [win64,linux64,linuxarm64]
2020-09-03 00:15:17 +00:00
steps:
- name: Checkout
2022-05-06 16:04:02 +00:00
uses: actions/checkout@v3
- name: Install buildx
2022-05-06 16:04:02 +00:00
uses: docker/setup-buildx-action@v2
with:
config: .github/buildkit.toml
- name: Login to Docker
2022-05-06 16:04:02 +00:00
uses: docker/login-action@v2
2020-09-03 00:15:17 +00:00
with:
2021-04-05 17:51:41 +00:00
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
2020-09-27 21:46:53 +00:00
- name: Image Name
id: imagename
2022-10-23 00:51:12 +00:00
run: echo "name=ghcr.io/${GITHUB_REPOSITORY,,}/base-${{ matrix.target }}" >> $GITHUB_OUTPUT
- name: Stop Commands
run: T="$(echo -n ${{ github.token }} | sha256sum | head -c 64)" && echo -e "::add-mask::${T}\n::stop-commands::${T}"
2020-09-20 00:40:08 +00:00
- name: Build target base image
2022-05-06 16:04:02 +00:00
uses: docker/build-push-action@v3
with:
context: images/base-${{ matrix.target }}
pull: true
push: true
2021-11-13 18:16:18 +00:00
tags: ${{ steps.imagename.outputs.name }}:latest
cache-to: type=registry,mode=max,ref=${{ steps.imagename.outputs.name }}:cache
cache-from: type=registry,ref=${{ steps.imagename.outputs.name }}:cache
2020-09-03 00:15:17 +00:00
build_targets:
2020-09-03 12:41:26 +00:00
name: Build target-variant image
if: ${{ github.event.inputs.buildOnly != 'true' }}
2020-09-03 00:15:17 +00:00
needs: build_target_bases
runs-on: ubuntu-latest
strategy:
2020-09-06 02:08:17 +00:00
fail-fast: false
2020-09-03 00:15:17 +00:00
matrix:
2022-07-06 15:00:37 +00:00
target: [win64,linux64,linuxarm64]
variant: [gpl,lgpl,gpl 4.4,gpl 5.1,lgpl 4.4,lgpl 5.1,gpl-shared,lgpl-shared,gpl-shared 4.4,gpl-shared 5.1,lgpl-shared 4.4,lgpl-shared 5.1]
2020-09-03 00:15:17 +00:00
steps:
- name: Checkout
2022-05-06 16:04:02 +00:00
uses: actions/checkout@v3
- name: Install buildx
2022-05-06 16:04:02 +00:00
uses: docker/setup-buildx-action@v2
2021-11-13 15:25:52 +00:00
with:
config: .github/buildkit.toml
- name: Login to Docker
2022-05-06 16:04:02 +00:00
uses: docker/login-action@v2
2020-09-03 00:15:17 +00:00
with:
2021-04-05 17:51:41 +00:00
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Generate Dockerfile
run: ./generate.sh ${{ matrix.target }} ${{ matrix.variant }}
2020-09-27 21:40:54 +00:00
- name: Image Name
id: imagename
run: |
IMG="ghcr.io/${GITHUB_REPOSITORY,,}/${{ matrix.target }}-${{ matrix.variant }}"
2022-10-23 00:51:12 +00:00
echo "name=${IMG/ /-}" >> $GITHUB_OUTPUT
echo "gh_repo=${GITHUB_REPOSITORY,,}" >> $GITHUB_OUTPUT
- name: Stop Commands
run: T="$(echo -n ${{ github.token }} | sha256sum | head -c 64)" && echo -e "::add-mask::${T}\n::stop-commands::${T}"
- name: Build target base image
2022-05-06 16:04:02 +00:00
uses: docker/build-push-action@v3
with:
context: .
pull: true
push: true
2021-11-13 18:16:18 +00:00
tags: ${{ steps.imagename.outputs.name }}:latest
cache-to: type=registry,mode=max,ref=${{ steps.imagename.outputs.name }}:cache
cache-from: type=registry,ref=${{ steps.imagename.outputs.name }}:cache
build-args: |
GH_REPO=ghcr.io/${{ steps.imagename.outputs.gh_repo }}
2020-09-03 14:33:29 +00:00
build_ffmpeg:
name: Build ffmpeg
2022-06-13 10:24:41 +00:00
if: ${{ ( github.event.inputs.buildOnly == 'true' && !cancelled() ) || success() }}
2020-09-03 14:33:29 +00:00
needs: build_targets
runs-on: ubuntu-latest
strategy:
2020-09-06 02:08:17 +00:00
fail-fast: false
2020-09-03 14:33:29 +00:00
matrix:
2022-07-06 15:00:37 +00:00
target: [win64,linux64,linuxarm64]
variant: [gpl,lgpl,gpl 4.4,gpl 5.1,lgpl 4.4,lgpl 5.1,gpl-shared,lgpl-shared,gpl-shared 4.4,gpl-shared 5.1,lgpl-shared 4.4,lgpl-shared 5.1]
2020-09-03 14:40:19 +00:00
steps:
- name: Checkout
2022-05-06 16:04:02 +00:00
uses: actions/checkout@v3
- name: Login to Docker
2022-05-06 16:04:02 +00:00
uses: docker/login-action@v2
with:
2021-04-05 17:51:41 +00:00
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
2020-09-03 14:40:19 +00:00
- name: Build ffmpeg
run: |
T="$(echo -n ${{ github.token }} | sha256sum | head -c 64)" && echo -e "::add-mask::${T}\n::stop-commands::${T}"
./build.sh ${{ matrix.target }} ${{ matrix.variant }}
2020-09-03 14:40:19 +00:00
- name: Upload artifacts
2022-05-06 16:04:02 +00:00
uses: actions/upload-artifact@v3
2020-09-03 14:40:19 +00:00
with:
name: ffmpeg
path: artifacts/*
2020-09-03 15:19:35 +00:00
publish_release:
name: Publish release
2022-06-13 10:24:41 +00:00
if: ${{ !cancelled() && ( github.event_name == 'schedule' || github.event.inputs.doRelease == 'true' ) && needs.build_ffmpeg.result == 'success' }}
2020-09-03 15:19:35 +00:00
needs: build_ffmpeg
runs-on: ubuntu-latest
steps:
- name: Checkout
2022-05-06 16:04:02 +00:00
uses: actions/checkout@v3
2020-09-03 15:19:35 +00:00
- name: Download artifacts
2022-05-06 16:04:02 +00:00
uses: actions/download-artifact@v3
2020-09-03 15:19:35 +00:00
with:
name: ffmpeg
2020-09-03 15:42:29 +00:00
path: artifacts
2020-09-03 15:19:35 +00:00
- name: Create release
2020-09-30 19:27:42 +00:00
id: create_release
2020-09-03 16:27:19 +00:00
run: |
set -xe
2022-06-12 15:03:50 +00:00
shopt -s nullglob
2021-12-24 15:49:28 +00:00
RELDATE="$(date +'%Y-%m-%d %H:%M')"
NAME="Auto-Build $RELDATE"
2020-09-03 16:27:19 +00:00
TAGNAME="autobuild-$(date +'%Y-%m-%d-%H-%M')"
2021-05-13 17:48:49 +00:00
hub release create $(for a in artifacts/*.{zip,tar.xz}; do echo -a $a; done) -m "$NAME" -t "master" "$TAGNAME"
2022-10-23 00:51:12 +00:00
echo "tag_name=${TAGNAME}" >> $GITHUB_OUTPUT
echo "rel_date=${RELDATE}" >> $GITHUB_OUTPUT
2021-12-24 15:49:28 +00:00
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Update Latest
run: |
set -xe
2022-06-12 15:03:50 +00:00
shopt -s nullglob
2021-12-24 15:49:28 +00:00
mkdir latest_artifacts
./util/repack_latest.sh latest_artifacts artifacts/*.{zip,tar.xz}
NAME="Latest Auto-Build (${{ steps.create_release.outputs.rel_date }})"
TAGNAME="latest"
hub release delete "$TAGNAME" || true
git push --delete origin "$TAGNAME" || true
sleep 30
2021-12-24 15:49:28 +00:00
hub release create $(for a in latest_artifacts/*; do echo -a $a; done) -m "$NAME" -t "master" "$TAGNAME"
2020-09-03 15:19:35 +00:00
env:
2020-09-30 19:27:42 +00:00
GITHUB_TOKEN: ${{ github.token }}
- name: Update Wiki
run: ./util/update_wiki.sh artifacts ${{ steps.create_release.outputs.tag_name }}
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Prune old releases
run: ./util/prunetags.sh
env:
2020-09-30 19:27:42 +00:00
GITHUB_TOKEN: ${{ github.token }}