Fix: Simplify Gitea Actions workflow to use docker runner
Some checks failed
Build and Push Docker Image / build (push) Failing after 7s

This commit is contained in:
Ben
2025-12-28 05:29:04 +00:00
parent 9931bdf2e4
commit 06399c273b

View File

@@ -6,50 +6,26 @@ on:
- main
tags:
- 'v*'
pull_request:
branches:
- main
env:
REGISTRY: gitea.ext.ben.io
IMAGE_NAME: b3nw/plex-mcp
jobs:
build:
runs-on: ubuntu-latest
runs-on: docker
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Extract tag
id: extract
run: |
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
echo "tag=latest" >> $GITHUB_OUTPUT
elif [[ "${{ github.ref }}" == refs/tags/* ]]; then
TAG=${GITHUB_REF#refs/tags/}
echo "tag=${TAG}" >> $GITHUB_OUTPUT
fi
- name: Log in to Gitea Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Extract metadata (tags, labels)
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha,prefix=
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build and Push Docker Image
run: |
docker build -t git.local.ben.io/b3nw/plex-mcp:${{ steps.extract.outputs.tag }} .
docker login -u ${{ secrets.REGISTRY_USERNAME }} -p ${{ secrets.REGISTRY_PASSWORD }} git.local.ben.io
docker push git.local.ben.io/b3nw/plex-mcp:${{ steps.extract.outputs.tag }}