FFmpeg-Builds/.github/workflows/build.yml
BtbN 611b7a694c Revert "Try to work around buildkit bug"
Should be fixed upstream now

This reverts commit d1d43c42b0.
2021-12-05 21:47:21 +01:00

179 lines
6 KiB
YAML

name: Build FFmpeg
on:
push:
paths-ignore:
- '**.md'
- 'LICENSE'
repository_dispatch:
types: [build]
schedule:
- cron: '0 12 * * *'
env:
DOCKER_BUILDKIT: 1
jobs:
build_base:
name: Build base image
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install buildx
uses: docker/setup-buildx-action@v1
with:
config: .github/buildkit.toml
- name: Login to Docker
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Image Name
id: imagename
run: echo "::set-output name=name::ghcr.io/${GITHUB_REPOSITORY,,}/base"
- 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
uses: docker/build-push-action@v2
with:
context: images/base
pull: true
push: true
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_target_bases:
name: Build target base image
needs: build_base
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target: [win64,linux64]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install buildx
uses: docker/setup-buildx-action@v1
with:
config: .github/buildkit.toml
- name: Login to Docker
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Image Name
id: imagename
run: echo "::set-output name=name::ghcr.io/${GITHUB_REPOSITORY,,}/base-${{ matrix.target }}"
- 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
uses: docker/build-push-action@v2
with:
context: images/base-${{ matrix.target }}
pull: true
push: true
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_targets:
name: Build target-variant image
needs: build_target_bases
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target: [win64,linux64]
variant: [gpl,lgpl,gpl 4.4,lgpl 4.4,gpl-shared,lgpl-shared,gpl-shared 4.4,lgpl-shared 4.4]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install buildx
uses: docker/setup-buildx-action@v1
with:
config: .github/buildkit.toml
- name: Login to Docker
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Generate Dockerfile
run: ./generate.sh ${{ matrix.target }} ${{ matrix.variant }}
- name: Image Name
id: imagename
run: |
IMG="ghcr.io/${GITHUB_REPOSITORY,,}/${{ matrix.target }}-${{ matrix.variant }}"
echo "::set-output name=name::${IMG/ /-}"
- 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
uses: docker/build-push-action@v2
with:
context: .
pull: true
push: true
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_ffmpeg:
name: Build ffmpeg
needs: build_targets
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target: [win64,linux64]
variant: [gpl,lgpl,gpl 4.4,lgpl 4.4,gpl-shared,lgpl-shared,gpl-shared 4.4,lgpl-shared 4.4]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Login to Docker
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- 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 }}
- 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
id: 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/*.{zip,tar.xz}; do echo -a $a; done) -m "$NAME" -t "master" "$TAGNAME"
echo "::set-output name=tag_name::${TAGNAME}"
env:
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:
GITHUB_TOKEN: ${{ github.token }}