Update Docker and CI workflow for refactored project structure

- Fix CI workflow to reference src/version.py instead of version.py
- Update Python import paths for version extraction in AppImage job
- Fix Dockerfile to use requirements.txt and copy src/ directory
- Remove deprecated --web flag from Docker CMD
- Remove obsolete version: '3.8' from docker-compose.yml
- Add Docker build job to CI workflow with multi-arch support (amd64, arm64)
- Push Docker images to GitHub Container Registry (ghcr.io)
- Add OCI image labels with build metadata to Dockerfile
- Update README with pre-built Docker image instructions
- Update funding information

All changes ensure compatibility with the refactored src/ package structure
and enable automated Docker image publishing via GitHub Actions.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Fengqing Liu
2025-10-16 23:28:00 +11:00
parent 423ee451ac
commit 8b2c28f76d
5 changed files with 105 additions and 15 deletions

View File

@@ -58,9 +58,9 @@ jobs:
- name: Append git revision to project version
run: |
(Get-Content version.py) `
(Get-Content src/version.py) `
-Replace '^__version__\s*=\s*"[^"]+', "`$0.${{steps.vars.outputs.sha_short}}" |`
Out-File version.py
Out-File src/version.py
# Ensure Python version
- name: Set up Python
@@ -131,7 +131,7 @@ jobs:
- name: Append git revision to project version
run: |
sed -ri "s/^__version__\s*=\s*\"[^\"]+/\0.${{steps.vars.outputs.sha_short}}/" version.py
sed -ri "s/^__version__\s*=\s*\"[^\"]+/\0.${{steps.vars.outputs.sha_short}}/" src/version.py
# Ensure Python version
- name: Set up Python
@@ -209,12 +209,12 @@ jobs:
- name: Set up variables
id: vars
run: |
echo "app_version=$(python3 -c 'from version import __version__ as v; print(v)')" >> "${GITHUB_OUTPUT}"
echo "app_version=$(python3 -c 'import sys; sys.path.insert(0, "src"); from version import __version__ as v; print(v)')" >> "${GITHUB_OUTPUT}"
echo "sha_short=$(git rev-parse --short HEAD)" >> "${GITHUB_OUTPUT}"
- name: Append git revision to project version
run: |
sed -ri "s/^__version__\s*=\s*\"[^\"]+/\0.${{steps.vars.outputs.sha_short}}/" version.py
sed -ri "s/^__version__\s*=\s*\"[^\"]+/\0.${{steps.vars.outputs.sha_short}}/" src/version.py
- name: Install system dependencies
run: |
@@ -249,6 +249,62 @@ jobs:
name: Twitch.Drops.Miner.Linux.AppImage-${{matrix.arch}}
path: Twitch.Drops.Miner.Linux.AppImage-${{matrix.arch}}.zip
docker:
name: Docker Build
runs-on: ubuntu-latest
needs:
- validate
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up variables
id: vars
run: |
echo "sha_short=$(git rev-parse --short HEAD)" >> "${GITHUB_OUTPUT}"
echo "date=$(date +%Y-%m-%d)" >> "${GITHUB_OUTPUT}"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}
- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{github.repository}}
tags: |
type=raw,value=dev
type=raw,value=dev-${{steps.vars.outputs.sha_short}}
type=raw,value=latest,enable=${{github.ref == 'refs/heads/master'}}
type=sha,prefix=
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
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
build-args: |
BUILD_DATE=${{steps.vars.outputs.date}}
VCS_REF=${{github.sha}}
VERSION=dev-${{steps.vars.outputs.sha_short}}
update_releases_page:
name: Upload builds to Releases
if: github.event_name != 'pull_request'