Files
tubesync/.gitea/workflows/container.yml
wimby 0e0a34ff6a
Some checks failed
Build TubeSync image / container (push) Failing after 3m35s
ci: install Docker Buildx
2026-09-26 02:04:38 +02:00

93 lines
3.3 KiB
YAML

name: Build TubeSync image
on:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: read
packages: write
jobs:
container:
runs-on: ubuntu-latest
timeout-minutes: 120
steps:
- name: Install build tools
run: |
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ca-certificates curl docker.io docker-buildx git jq
rm -rf /var/lib/apt/lists/*
- name: Check out repository
shell: bash
run: |
set -euo pipefail
git init .
git remote add origin "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git"
git fetch --depth=1 origin "${GITHUB_SHA}"
git checkout --detach FETCH_HEAD
- name: Resolve upstream dependency versions
shell: bash
run: |
set -euo pipefail
ffmpeg_json="$(curl -fsSL 'https://api.github.com/repos/yt-dlp/FFmpeg-Builds/releases?per_page=10')"
ffmpeg_tag="$(jq -r '[.[] | select((.draft or .prerelease) | not)][0].tag_name' <<<"${ffmpeg_json}")"
ffmpeg_date="${ffmpeg_tag#autobuild-}"
ffmpeg_version="$(jq -r '[.[] | select((.draft or .prerelease) | not)][0].assets[].name | select(test("-linuxarm64-")) | capture("^ffmpeg-(?<v>.+)-linuxarm64-").v' <<<"${ffmpeg_json}" | head -n1)"
ytdlp_date="$(curl -fsSL https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest | jq -r .tag_name)"
ejs_version="$(curl -fsSL https://api.github.com/repos/yt-dlp/ejs/releases/latest | jq -r .tag_name)"
test -n "${ffmpeg_date}"
test -n "${ffmpeg_version}"
test -n "${ytdlp_date}"
test -n "${ejs_version}"
{
echo "FFMPEG_DATE=${ffmpeg_date}"
echo "FFMPEG_VERSION=${ffmpeg_version}"
echo "YTDLP_DATE=${ytdlp_date}"
echo "YTDLP_EJS_VERSION=${ejs_version}"
} >> "${GITHUB_ENV}"
- name: Log in to Gitea registry
shell: bash
env:
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
run: |
set -euo pipefail
if [ -z "${REGISTRY_TOKEN:-}" ]; then
echo "REGISTRY_TOKEN is not configured; image will build but publishing is skipped."
exit 0
fi
echo "${REGISTRY_TOKEN}" | docker login git.wimby.cz --username wimby --password-stdin
- name: Build image
shell: bash
run: |
set -euo pipefail
short_sha="${GITHUB_SHA:0:12}"
DOCKER_BUILDKIT=1 docker build \
--build-arg FFMPEG_DATE="${FFMPEG_DATE}" \
--build-arg FFMPEG_VERSION="${FFMPEG_VERSION}" \
--build-arg YTDLP_DATE="${YTDLP_DATE}" \
--build-arg YTDLP_EJS_VERSION="${YTDLP_EJS_VERSION}" \
--tag "git.wimby.cz/wimby/tubesync:latest" \
--tag "git.wimby.cz/wimby/tubesync:${short_sha}" \
.
- name: Push image
shell: bash
env:
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
run: |
set -euo pipefail
if [ -z "${REGISTRY_TOKEN:-}" ]; then
echo "REGISTRY_TOKEN is not configured; skipping publish."
exit 0
fi
short_sha="${GITHUB_SHA:0:12}"
docker push "git.wimby.cz/wimby/tubesync:${short_sha}"
docker push "git.wimby.cz/wimby/tubesync:latest"