Files
felixfoertsch c2399fe311
Test, Build and Push Container Image / build (push) Failing after 33s
require package registry credential
2026-09-17 19:53:07 +02:00

52 lines
1.5 KiB
YAML

name: Test, Build and Push Container Image
on:
workflow_dispatch:
push:
branches: [main]
concurrency:
group: container-${{ github.ref }}
cancel-in-progress: true
env:
REGISTRY: git.felixfoertsch.de
IMAGE: felixfoertsch/ios-advanced-parental-controls
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Test backend
run: |
python3 -m venv .venv
.venv/bin/pip install -r backend/requirements-dev.txt
.venv/bin/pytest -c backend/pyproject.toml backend/tests
- name: Check dashboard JavaScript
run: node --check backend/src/apc/static/app.js
- name: Log in to Gitea Container Registry
run: echo "${{ secrets.REGISTRY_TOKEN }}" | docker login "$REGISTRY" -u "${{ github.actor }}" --password-stdin
- name: Build and push image
run: |
docker buildx create --use --name ci-builder --driver docker-container || docker buildx use ci-builder
docker buildx build \
--platform linux/amd64 \
--push \
--cache-from "type=registry,ref=$REGISTRY/$IMAGE:buildcache" \
--cache-to "type=registry,ref=$REGISTRY/$IMAGE:buildcache,mode=max" \
-t "$REGISTRY/$IMAGE:latest" \
-t "$REGISTRY/$IMAGE:sha-${GITHUB_SHA}" \
.
- name: Prune local BuildKit cache
if: always()
run: |
if docker buildx use ci-builder; then
docker buildx prune --builder ci-builder --all --force --max-used-space 10gb
fi