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

195 lines
6.7 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: Install buildx
uses: docker/setup-buildx-action@v1
with:
config: .github/buildkit.toml
- 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-11-13 18:16:18 +00:00
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
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
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: Install buildx
uses: docker/setup-buildx-action@v1
with:
config: .github/buildkit.toml
- 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-11-13 18:16:18 +00:00
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}"
2020-09-20 00:40:08 +00:00
- name: Build target base image
uses: docker/build-push-action@v2
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
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:
target: [win64,linux64]
variant: [gpl,lgpl,gpl 4.4,gpl 5.0,lgpl 4.4,lgpl 5.0,gpl-shared,lgpl-shared,gpl-shared 4.4,gpl-shared 5.0,lgpl-shared 4.4,lgpl-shared 5.0]
2020-09-03 00:15:17 +00:00
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install buildx
uses: docker/setup-buildx-action@v1
2021-11-13 15:25:52 +00:00
with:
config: .github/buildkit.toml
- 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 }}
- 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 }}"
2021-11-13 18:16:18 +00:00
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
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 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]
2022-01-14 19:44:21 +00:00
variant: [gpl,lgpl,gpl 4.4,gpl 5.0,lgpl 4.4,lgpl 5.0,gpl-shared,lgpl-shared,gpl-shared 4.4,gpl-shared 5.0,lgpl-shared 4.4,lgpl-shared 5.0]
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: |
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
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
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"
2020-09-30 19:27:42 +00:00
echo "::set-output name=tag_name::${TAGNAME}"
2021-12-24 15:49:28 +00:00
echo "::set-output name=rel_date::${RELDATE}"
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Update Latest
run: |
set -xe
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 }}