mirror of
https://github.com/MarekWo/mc-webui.git
synced 2026-05-02 19:42:38 +02:00
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 <noreply@anthropic.com>
This commit is contained in:
47
.github/workflows/docker-publish.yml
vendored
Normal file
47
.github/workflows/docker-publish.yml
vendored
Normal file
@@ -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 }}
|
||||
Reference in New Issue
Block a user