From 24ca50cdf2614fa71d6b834baea7e0e61f861ea0 Mon Sep 17 00:00:00 2001 From: voc0der Date: Sat, 7 Feb 2026 16:27:22 -0500 Subject: [PATCH] Add manual trigger to docker-pr workflow for test builds Adds workflow_dispatch trigger that allows: - Manual workflow runs from GitHub Actions UI - Optional push to registry (choice: true/false) - Custom image tag (e.g., test, pr-13) Normal PR behavior unchanged (push: false). When manually triggered, can push test images to both: - DockerHub: tzahi12345/youtubedl-material: - GHCR: ghcr.io/voc0der/youtubedl-material: --- .github/workflows/docker-pr.yml | 46 +++++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-pr.yml b/.github/workflows/docker-pr.yml index 52d428e..8889e26 100644 --- a/.github/workflows/docker-pr.yml +++ b/.github/workflows/docker-pr.yml @@ -3,6 +3,21 @@ name: docker-pr on: pull_request: branches: [master] + workflow_dispatch: + inputs: + push_image: + description: 'Push image to registry' + required: true + default: 'false' + type: choice + options: + - 'true' + - 'false' + image_tag: + description: 'Docker image tag (e.g., test, pr-13)' + required: true + default: 'test' + type: string jobs: build-and-push: @@ -27,6 +42,33 @@ jobs: uses: docker/setup-qemu-action@v3 - name: setup multi-arch docker build uses: docker/setup-buildx-action@v3 + + - name: Login to DockerHub + if: github.event.inputs.push_image == 'true' + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Login to GitHub Container Registry + if: github.event.inputs.push_image == 'true' + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Set push and tag values + id: build_params + run: | + if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then + echo "push=${{ github.event.inputs.push_image }}" >> $GITHUB_OUTPUT + echo "tags=tzahi12345/youtubedl-material:${{ github.event.inputs.image_tag }},ghcr.io/${{ github.repository_owner }}/youtubedl-material:${{ github.event.inputs.image_tag }}" >> $GITHUB_OUTPUT + else + echo "push=false" >> $GITHUB_OUTPUT + echo "tags=tzahi12345/youtubedl-material:nightly-pr" >> $GITHUB_OUTPUT + fi + - name: build & push images uses: docker/build-push-action@v6 with: @@ -34,5 +76,5 @@ jobs: file: ./Dockerfile platforms: linux/amd64,linux/arm/v7,linux/arm64/v8 #platforms: linux/amd64 - push: false - tags: tzahi12345/youtubedl-material:nightly-pr + push: ${{ steps.build_params.outputs.push }} + tags: ${{ steps.build_params.outputs.tags }}