Refactor CI workflow in docker-publish.yml: streamline steps and update job configuration
Some checks failed
CI / ci (push) Failing after 0s

This commit is contained in:
Joakim Hellsén 2026-03-17 20:45:58 +01:00
commit 098a0b516e
Signed by: Joakim Hellsén
SSH key fingerprint: SHA256:/9h/CsExpFp+PRhsfA0xznFx2CGfTT5R/kpuFfUgEQk

View file

@ -1,4 +1,4 @@
name: Build Docker Image name: CI
on: on:
push: push:
@ -6,50 +6,30 @@ on:
workflow_dispatch: workflow_dispatch:
jobs: jobs:
docker: ci:
runs-on: ubuntu-latest runs-on: self-hosted
env: env:
DISCORD_TOKEN: "0" DISCORD_TOKEN: "0"
OPENAI_TOKEN: "0" OPENAI_TOKEN: "0"
steps:
# GitHub Container Registry
- uses: docker/login-action@v4
if: github.event_name != 'pull_request'
with:
registry: ghcr.io
username: thelovinator1
password: ${{ secrets.GITHUB_TOKEN }}
# Download the latest commit from the master branch steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v6
# Install the latest version of ruff
- uses: astral-sh/ruff-action@v3 - uses: astral-sh/ruff-action@v3
with: with:
version: "latest" version: "latest"
# Lint the Python code using ruff - name: Install dependencies
- run: ruff check --exit-non-zero-on-fix --verbose run: uv sync --all-extras --dev -U
# Check if the Python code needs formatting - name: Lint the Python code using ruff
- run: ruff format --check --verbose run: ruff check --exit-non-zero-on-fix --verbose
# Lint Dockerfile - name: Check formatting
- run: docker build --check . run: ruff format --check --verbose
# Extract metadata (tags, labels) from Git reference and GitHub events for Docker - name: Lint Dockerfile (build only)
- id: meta run: docker build --check .
uses: docker/metadata-action@v6
if: github.ref == 'refs/heads/master'
with:
images: ghcr.io/thelovinator1/anewdawn
tags: type=raw,value=latest
# Build and push the Docker image - name: Run tests
- uses: docker/build-push-action@v7 run: uv run pytest
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/master'
with:
context: .
push: true
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.meta.outputs.tags }}