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