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:<tag>
- GHCR: ghcr.io/voc0der/youtubedl-material:<tag>
pull/1163/head
voc0der 2 months ago
parent 5c7338f1ce
commit 24ca50cdf2

@ -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 }}

Loading…
Cancel
Save