From bc578c7018f65b0e2f1d2c15c32d75832830fc0a Mon Sep 17 00:00:00 2001 From: MarekWo Date: Wed, 1 Apr 2026 15:00:32 +0200 Subject: [PATCH] ci: add Docker Hub publish workflow Automatically builds and pushes mc-webui image to Docker Hub (mawoj/mc-webui) on push to main, with manual trigger support. Tags: latest + version from git (e.g. 2026.04.01-b286072). Based on x9daniel's PR #21, adapted for Docker Hub. Co-Authored-By: Claude Opus 4.6 --- .github/workflows/docker-publish.yml | 47 ++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .github/workflows/docker-publish.yml diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml new file mode 100644 index 0000000..570242d --- /dev/null +++ b/.github/workflows/docker-publish.yml @@ -0,0 +1,47 @@ +name: Build and Push mc-webui image + +on: + push: + branches: [main] + workflow_dispatch: # Manual trigger + +jobs: + build-and-push: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.11' + + - name: Freeze App Version + run: python3 -m app.version freeze + + - name: Extract version tag + id: get_tag + run: | + TAG_VALUE=$(grep "DOCKER_TAG =" app/version_frozen.py | cut -d'"' -f2) + echo "Extracted Tag: $TAG_VALUE" + echo "tag=$TAG_VALUE" >> $GITHUB_OUTPUT + + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + file: ./Dockerfile + push: true + tags: | + ${{ secrets.DOCKERHUB_USERNAME }}/mc-webui:latest + ${{ secrets.DOCKERHUB_USERNAME }}/mc-webui:${{ steps.get_tag.outputs.tag }}