Merge remote-tracking branch 'upstream/master' #19
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build FFmpeg | |
on: | |
push: | |
paths-ignore: | |
- '**.md' | |
- 'LICENSE' | |
env: | |
DOCKER_BUILDKIT: 1 | |
jobs: | |
build_base: | |
name: Build base image | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
config: .github/buildkit.toml | |
- name: Login to Docker | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ github.token }} | |
- name: Image Name | |
id: imagename | |
run: | | |
IMG="${GITHUB_REPOSITORY,,}/base" | |
DLIMG="${GITHUB_REPOSITORY,,}/dl_cache" | |
echo "name=ghcr.io/${IMG/ /-}" >> $GITHUB_OUTPUT | |
echo "rawname=${IMG/ /-}" >> $GITHUB_OUTPUT | |
echo "dlname=ghcr.io/${DLIMG/ /-}" >> $GITHUB_OUTPUT | |
echo "dlrawname=${DLIMG/ /-}" >> $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 | |
uses: docker/build-push-action@v5 | |
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 | |
- name: Generate download cache Dockerfile | |
id: dl_cache | |
run: | | |
./generate.sh dl only | |
echo "dltagname=$(./util/get_dl_cache_tag.sh)" >> $GITHUB_OUTPUT | |
cat Dockerfile.dl | |
- name: Build download cache image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: Dockerfile.dl | |
pull: true | |
push: true | |
tags: ${{ steps.imagename.outputs.dlname }}:${{ steps.dl_cache.outputs.dltagname }} | |
cache-to: type=registry,mode=max,ref=${{ steps.imagename.outputs.dlname }}:cache | |
cache-from: type=registry,ref=${{ steps.imagename.outputs.dlname }}:cache | |
build_target_bases: | |
name: Build target base image | |
needs: build_base | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
strategy: | |
fail-fast: false | |
matrix: | |
target: | |
- win32 | |
- win64 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
config: .github/buildkit.toml | |
- name: Login to Docker | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ github.token }} | |
- name: Image Name | |
id: imagename | |
run: | | |
IMG="${GITHUB_REPOSITORY,,}/base-${{ matrix.target }}" | |
echo "name=ghcr.io/${IMG/ /-}" >> $GITHUB_OUTPUT | |
echo "rawname=${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 | |
uses: docker/build-push-action@v5 | |
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-args: | | |
GH_REPO=ghcr.io/${{ steps.imagename.outputs.gh_repo }} | |
build_targets: | |
name: Build target-variant image | |
needs: build_target_bases | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
strategy: | |
fail-fast: false | |
matrix: | |
target: | |
- win32 | |
- win64 | |
variant: | |
- gpl 6.0 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
config: .github/buildkit.toml | |
- name: Login to Docker | |
uses: docker/login-action@v3 | |
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="${GITHUB_REPOSITORY,,}/${{ matrix.target }}-${{ matrix.variant }}" | |
echo "name=ghcr.io/${IMG/ /-}" >> $GITHUB_OUTPUT | |
echo "rawname=${IMG/ /-}" >> $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 | |
uses: docker/build-push-action@v5 | |
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 | |
permissions: | |
packages: read | |
strategy: | |
fail-fast: false | |
matrix: | |
target: | |
- win32 | |
- win64 | |
variant: | |
- gpl 6.0 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Login to Docker | |
uses: docker/login-action@v3 | |
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@v3 | |
with: | |
name: ffmpeg-${{ matrix.target }} | |
path: artifacts/* | |
publish_release: | |
name: Publish release | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
needs: build_ffmpeg | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
path: artifacts | |
- name: Deploy | |
run: ./deploy.sh ./artifacts/**/* | |
env: | |
RELEASES_API_KEY: ${{ github.token }} |