FFmpeg-Builds/.github/workflows/build.yml
2020-09-23 10:29:54 +02:00

133 lines
4.7 KiB
YAML

name: Build FFmpeg
on:
push: []
repository_dispatch:
types: [build]
schedule:
- cron: '0 12 * * *'
jobs:
build_base:
name: Build base image
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Login to Docker
uses: docker/login-action@v1
with:
registry: docker.pkg.github.com
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Pull latest
run: docker pull docker.pkg.github.com/${GITHUB_REPOSITORY,,}/base:latest || true
- name: Build base image
run: |
IMG="docker.pkg.github.com/${GITHUB_REPOSITORY,,}/base:latest"
docker build --pull --cache-from "$IMG" --tag "$IMG" images/base
- name: Push base image
run: docker push docker.pkg.github.com/${GITHUB_REPOSITORY,,}/base:latest
build_target_bases:
name: Build target base image
needs: build_base
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target: [win64]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Login to Docker
uses: docker/login-action@v1
with:
registry: docker.pkg.github.com
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Pull latest
run: docker pull docker.pkg.github.com/${GITHUB_REPOSITORY,,}/base-${{ matrix.target }}:latest || true
- name: Build target base image
run: |
IMG="docker.pkg.github.com/${GITHUB_REPOSITORY,,}/base-${{ matrix.target }}:latest"
docker build --pull --build-arg GH_REPO=${GITHUB_REPOSITORY,,} --cache-from "$IMG" --tag "$IMG" images/base-${{ matrix.target }}
- name: Push target base image
run: docker push docker.pkg.github.com/${GITHUB_REPOSITORY,,}/base-${{ matrix.target }}:latest
build_targets:
name: Build target-variant image
needs: build_target_bases
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target: [win64]
variant: [gpl,lgpl,gpl-vulkan,lgpl-vulkan,gpl-4.3,lgpl-4.3,gpl-shared,lgpl-shared,gpl-vulkan-shared,lgpl-vulkan-shared,gpl-4.3-shared,lgpl-4.3-shared]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Generate Dockerfile
run: ./generate.sh ${{ matrix.target }} ${{ matrix.variant }}
- name: Login to Docker
uses: docker/login-action@v1
with:
registry: docker.pkg.github.com
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Pull latest
run: docker pull docker.pkg.github.com/${GITHUB_REPOSITORY,,}/${{ matrix.target }}-${{ matrix.variant }}:latest || true
- name: Build variant image
run: |
IMG="docker.pkg.github.com/${GITHUB_REPOSITORY,,}/${{ matrix.target }}-${{ matrix.variant }}:latest"
docker build --pull --cache-from "$IMG" --tag "$IMG" .
- name: Push variant image
run: docker push docker.pkg.github.com/${GITHUB_REPOSITORY,,}/${{ matrix.target }}-${{ matrix.variant }}:latest
build_ffmpeg:
name: Build ffmpeg
needs: build_targets
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target: [win64]
variant: [gpl,lgpl,gpl-vulkan,lgpl-vulkan,gpl-4.3,lgpl-4.3,gpl-shared,lgpl-shared,gpl-vulkan-shared,lgpl-vulkan-shared,gpl-4.3-shared,lgpl-4.3-shared]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Login to Docker
uses: docker/login-action@v1
with:
registry: docker.pkg.github.com
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Build ffmpeg
run: ./build.sh ${{ matrix.target }} ${{ matrix.variant }}
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: ffmpeg
path: artifacts/*
publish_release:
name: Publish release
if: github.event_name != 'push'
needs: build_ffmpeg
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Download artifacts
uses: actions/download-artifact@v2
with:
name: ffmpeg
path: artifacts
- name: Create release
run: |
set -xe
NAME="Auto-Build $(date +'%Y-%m-%d %H:%M')"
TAGNAME="autobuild-$(date +'%Y-%m-%d-%H-%M')"
hub release create $(for a in artifacts/*; do echo -a $a; done) -m "$NAME" -t "master" "$TAGNAME"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Prune old releases
run: ./util/prunetags.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}