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

153 lines
5.1 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'
2020-09-07 00:38:49 +00:00
repository_dispatch:
types: [build]
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
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Login to Docker
2020-09-20 00:40:08 +00:00
uses: docker/login-action@v1
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
2021-04-05 17:51:41 +00:00
run: echo "::set-output name=name::ghcr.io/${GITHUB_REPOSITORY,,}/base:latest"
2020-09-20 00:40:08 +00:00
- name: Build base image
2021-04-05 19:37:38 +00:00
run: docker build --pull --build-arg BUILDKIT_INLINE_CACHE=1 --cache-from ${{ steps.imagename.outputs.name }} --tag ${{ steps.imagename.outputs.name }} images/base
2020-09-20 00:40:08 +00:00
- name: Push base image
2020-09-27 21:46:53 +00:00
run: docker push ${{ steps.imagename.outputs.name }}
2020-09-03 00:15:17 +00:00
build_target_bases:
2020-09-03 12:41:26 +00:00
name: Build target base image
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:
2021-05-13 01:41:32 +00:00
target: [win64,linux64]
2020-09-03 00:15:17 +00:00
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Login to Docker
2020-09-20 00:40:08 +00:00
uses: docker/login-action@v1
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
2021-04-05 17:51:41 +00:00
run: echo "::set-output name=name::ghcr.io/${GITHUB_REPOSITORY,,}/base-${{ matrix.target }}:latest"
2020-09-20 00:40:08 +00:00
- name: Build target base image
2021-04-05 19:37:38 +00:00
run: docker build --pull --build-arg BUILDKIT_INLINE_CACHE=1 --build-arg GH_REPO=${GITHUB_REPOSITORY,,} --cache-from ${{ steps.imagename.outputs.name }} --tag ${{ steps.imagename.outputs.name }} images/base-${{ matrix.target }}
2020-09-20 00:40:08 +00:00
- name: Push target base image
2020-09-27 21:46:53 +00:00
run: docker push ${{ steps.imagename.outputs.name }}
2020-09-03 00:15:17 +00:00
build_targets:
2020-09-03 12:41:26 +00:00
name: Build target-variant image
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:
2021-05-13 01:41:32 +00:00
target: [win64,linux64]
2021-04-04 06:38:55 +00:00
variant: [gpl,lgpl,gpl 4.4,lgpl 4.4,gpl-shared,lgpl-shared,gpl-shared 4.4,lgpl-shared 4.4]
2020-09-03 00:15:17 +00:00
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install buildx
uses: docker/setup-buildx-action@v1
2020-09-03 00:15:17 +00:00
- name: Generate Dockerfile
run: ./generate.sh ${{ matrix.target }} ${{ matrix.variant }}
- name: Login to Docker
2020-09-20 00:40:08 +00:00
uses: docker/login-action@v1
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:40:54 +00:00
- name: Image Name
id: imagename
run: |
IMG="ghcr.io/${GITHUB_REPOSITORY,,}/${{ matrix.target }}-${{ matrix.variant }}"
echo "::set-output name=name::${IMG/ /-}:latest"
echo "::set-output name=cache_name::${IMG/ /-}:cache"
2020-09-27 21:40:54 +00:00
- name: Build variant image
run: |
docker buildx build \
--pull \
--tag ${{ steps.imagename.outputs.name }} \
--cache-to=type=registry,mode=max,ref=${{ steps.imagename.outputs.cache_name }} \
--cache-from=type=registry,ref=${{ steps.imagename.outputs.cache_name }} \
--output=type=image,push=true,name=${{ steps.imagename.outputs.name }} \
.
2020-09-03 14:33:29 +00:00
build_ffmpeg:
name: Build ffmpeg
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:
2021-05-13 01:41:32 +00:00
target: [win64,linux64]
2021-04-04 06:38:55 +00:00
variant: [gpl,lgpl,gpl 4.4,lgpl 4.4,gpl-shared,lgpl-shared,gpl-shared 4.4,lgpl-shared 4.4]
2020-09-03 14:40:19 +00:00
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Login to Docker
uses: docker/login-action@v1
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: ./build.sh ${{ matrix.target }} ${{ matrix.variant }}
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: ffmpeg
path: artifacts/*
2020-09-03 15:19:35 +00:00
publish_release:
name: Publish release
2020-09-07 00:38:49 +00:00
if: github.event_name != 'push'
2020-09-03 15:19:35 +00:00
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
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
NAME="Auto-Build $(date +'%Y-%m-%d %H:%M')"
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"
2020-09-30 19:27:42 +00:00
echo "::set-output name=tag_name::${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 }}