From 94db632043f107ae9b1bafe22c1a3c53f52ec257 Mon Sep 17 00:00:00 2001 From: DARKZOUL5 Date: Wed, 18 Mar 2026 18:10:25 +0200 Subject: [PATCH] Update Docker and workflow configurations for improved build process --- .dockerignore | 1 + .github/workflows/build.yml | 2 +- .github/workflows/build_v2.yml | 57 ++++++++++++++++++++++++++++++++-- Dockerfile | 10 +++--- README.md | 2 +- 5 files changed, 63 insertions(+), 9 deletions(-) diff --git a/.dockerignore b/.dockerignore index 68083ed..ecd18cf 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,4 +1,5 @@ .gitea/ +.github/ .venv/ ./bin/ # Python bytecode diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 43ace38..e855a99 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Build Release Packages +name: Build Release on: workflow_dispatch: diff --git a/.github/workflows/build_v2.yml b/.github/workflows/build_v2.yml index cd785d7..2fef6cd 100644 --- a/.github/workflows/build_v2.yml +++ b/.github/workflows/build_v2.yml @@ -118,13 +118,52 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 + + - name: Get version + id: version + shell: bash + run: | + TAG="${{ github.event.inputs.tag || inputs.tag }}" + VERSION="${TAG#v}" + echo "version=$VERSION" >> $GITHUB_OUTPUT + - name: Download Linux Artifact uses: actions/download-artifact@v4 with: name: linux-release - - name: Build and Push Docker (Optional) + path: dist/linux-docker + + - name: Prepare Docker build context run: | - echo "Placeholder for Docker build if needed" + cd dist/linux-docker + tar -xzf yt-playlist-linux-${{ steps.version.outputs.version }}.tar.gz + cp ../../Dockerfile . + cp ../../docker-entrypoint.sh . + # Ensure ytpld package is present + if [ ! -d "ytpld" ]; then cp -r ../../ytpld . ; fi + + - name: Set docker image names + run: | + VERSION="${{ steps.version.outputs.version }}" + echo "RELEASE_IMAGE=ghcr.io/${GITHUB_ACTOR}/ytpld:${VERSION}" >> $GITHUB_ENV + echo "LATEST_IMAGE=ghcr.io/${GITHUB_ACTOR}/ytpld:latest" >> $GITHUB_ENV + + - name: Build Docker image + run: | + docker build . -t $RELEASE_IMAGE -t $LATEST_IMAGE + working-directory: dist/linux-docker + + - name: Save Docker images + run: | + docker save -o docker-image.tar $RELEASE_IMAGE + docker save -o docker-image-latest.tar $LATEST_IMAGE + working-directory: dist/linux-docker + + - name: Upload Docker artifacts + uses: actions/upload-artifact@v4 + with: + name: docker-images + path: dist/linux-docker/docker-image*.tar release: needs: [build, docker] @@ -133,6 +172,20 @@ jobs: steps: - name: Download all artifacts uses: actions/download-artifact@v4 + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Push Docker images + run: | + docker load -i docker-images/docker-image.tar + docker push ghcr.io/${GITHUB_ACTOR}/ytpld:${{ steps.version.outputs.version }} + docker load -i docker-images/docker-image-latest.tar + docker push ghcr.io/${GITHUB_ACTOR}/ytpld:latest + - name: Create Release uses: softprops/action-gh-release@v2 with: diff --git a/Dockerfile b/Dockerfile index 5055360..0997d36 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,13 +4,13 @@ WORKDIR /app # Copy application code (package) and bootstrap COPY yt-playlist-main.py /app/ -COPY ytplaylist/ /app/ytplaylist/ +COPY ytpld/ /app/ytpld/ COPY config/ /app/config/ -# Copy helper binaries into a bin/ folder inside the image -COPY ./bin/ffmpeg /app/bin/ffmpeg -COPY ./bin/yt-dlp /app/bin/yt-dlp -COPY ./bin/aria2c /app/bin/aria2c +# Copy helper binaries from the build context (which includes extracted artifacts) +COPY bin/ffmpeg /app/bin/ffmpeg +COPY bin/yt-dlp /app/bin/yt-dlp +COPY bin/aria2c /app/bin/aria2c # Copy entrypoint that maps environment variables to CLI flags COPY docker-entrypoint.sh /app/docker-entrypoint.sh diff --git a/README.md b/README.md index 817b2e9..8a92e8a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # YouTube Playlist Downloader -[![Build Release Packages](https://github.com/darkzoul5/YoutubePlaylistDownloader/actions/workflows/release.yml/badge.svg?branch=main)](https://github.com/darkzoul5/YoutubePlaylistDownloader/actions/workflows/release.yml) +[![Build Release](https://github.com/darkzoul5/YoutubePlaylistDownloader/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/darkzoul5/YoutubePlaylistDownloader/actions/workflows/build.yml) A cross-platform tool for downloading entire YouTube playlists as MP3 or MP4 files, using [yt-dlp](https://github.com/yt-dlp/yt-dlp), [ffmpeg](https://ffmpeg.org/), and [aria2c](https://github.com/aria2/aria2). Includes Gitea CI/CD workflow for packaging and releasing Windows and Linux binaries.