diff --git a/.gitea/workflows/docker-build.yml b/.gitea/workflows/docker-build.yml index d02945a..9f62165 100644 --- a/.gitea/workflows/docker-build.yml +++ b/.gitea/workflows/docker-build.yml @@ -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 }}