4 Commits

Author SHA1 Message Date
177343fdbb feat(ci): push to Gitea container registry
Requires Docker on runner and REGISTRY_TOKEN secret configured.
Pushes to git.prettyhefty.com/bill/ffmpeg-worker with version tags.
2025-11-30 22:43:27 -05:00
830715abb3 fix(ci): skip docker if unavailable, no latest tag for prereleases
All checks were successful
Test and Build / test (push) Successful in 1m33s
Test and Build / build (push) Successful in 8s
Gitea: Skip docker build gracefully if docker command not available
GitHub: Only tag as latest for stable releases (not alpha/beta/rc)
2025-11-30 22:36:03 -05:00
291d0e78df 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
2025-11-30 18:32:55 -05:00
7a852607e6 fix(ci): use curl to install uv for Gitea compatibility
Some checks failed
Test and Build / test (push) Failing after 14s
Test and Build / build (push) Has been skipped
2025-11-30 18:29:31 -05:00
2 changed files with 70 additions and 26 deletions

View File

@@ -5,6 +5,10 @@ on:
tags:
- 'v*.*.*'
env:
REGISTRY: git.prettyhefty.com
IMAGE_NAME: bill/ffmpeg-worker
jobs:
test:
runs-on: ubuntu-latest
@@ -12,19 +16,29 @@ jobs:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v4
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Add uv to PATH
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Set up Python
run: uv python install 3.12
run: $HOME/.local/bin/uv python install 3.12
- name: Install dependencies
run: uv sync
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: uv run pytest tests/ -v --ignore=tests/test_integration.py
run: $HOME/.local/bin/uv run pytest tests/ -v --ignore=tests/test_integration.py
build:
needs: test
@@ -32,18 +46,29 @@ jobs:
steps:
- uses: actions/checkout@v4
- 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
run: |
VERSION=${GITHUB_REF#refs/tags/}
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
if [[ "$VERSION" == *-alpha* ]] || [[ "$VERSION" == *-beta* ]] || [[ "$VERSION" == *-rc* ]]; then
echo "IS_PRERELEASE=true" >> $GITHUB_OUTPUT
else
echo "IS_PRERELEASE=false" >> $GITHUB_OUTPUT
fi
- name: Build Docker image
uses: docker/build-push-action@v6
with:
context: .
push: false
tags: |
ffmpeg-worker:${{ steps.version.outputs.VERSION }}
ffmpeg-worker:latest
- name: Log in to Container Registry
run: echo "${{ secrets.REGISTRY_TOKEN }}" | docker login ${{ env.REGISTRY }} -u ${{ gitea.actor }} --password-stdin
- name: Build and push Docker image
run: |
docker build -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.VERSION }} .
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.VERSION }}
if [ "${{ steps.version.outputs.IS_PRERELEASE }}" = "false" ]; then
docker tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.VERSION }} ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
fi
- name: List images
run: docker images | grep ffmpeg-worker

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,enable=${{ !contains(github.ref, '-alpha') && !contains(github.ref, '-beta') && !contains(github.ref, '-rc') }}
- 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