fix(ci): handle missing sudo on Gitea, push to ghcr.io on GitHub
Some checks failed
Test and Build / test (push) Successful in 1m34s
Test and Build / build (push) Failing after 8s

Gitea: Try ffmpeg, then sudo apt-get, then apt-get without sudo
GitHub: Login to ghcr.io and push tagged image to container registry
This commit is contained in:
2025-11-30 18:32:55 -05:00
parent 7a852607e6
commit 291d0e78df
2 changed files with 36 additions and 10 deletions

View File

@@ -24,7 +24,14 @@ jobs:
run: $HOME/.local/bin/uv sync
- name: Install FFmpeg
run: sudo apt-get update && sudo apt-get install -y ffmpeg
run: |
if command -v ffmpeg &> /dev/null; then
echo "FFmpeg already installed"
elif command -v sudo &> /dev/null; then
sudo apt-get update && sudo apt-get install -y ffmpeg
else
apt-get update && apt-get install -y ffmpeg
fi
- name: Run tests
run: $HOME/.local/bin/uv run pytest tests/ -v --ignore=tests/test_integration.py

View File

@@ -5,6 +5,10 @@ on:
tags:
- 'v*.*.*'
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
test:
runs-on: ubuntu-latest
@@ -29,23 +33,38 @@ jobs:
build:
needs: test
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Log in to Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=latest
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Extract version from tag
id: version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Build Docker image
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
push: false
tags: |
ffmpeg-worker:${{ steps.version.outputs.VERSION }}
ffmpeg-worker:latest
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max