mirror of
https://github.com/plexguide/Huntarr.io.git
synced 2026-02-09 07:39:18 -06:00
chore: update Docker workflow to allow builds on dev branch, add manual trigger option, and refine push conditions
This commit is contained in:
20
.github/workflows/docker-build-push.yml
vendored
20
.github/workflows/docker-build-push.yml
vendored
@@ -3,14 +3,21 @@ name: Build and Push Docker Image
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
- dev # Only auto-build on dev branch
|
||||
tags:
|
||||
- 'v*'
|
||||
- 'v*' # Still allow tagged releases
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
- dev
|
||||
workflow_dispatch: # Allow manual triggering
|
||||
inputs:
|
||||
force_push:
|
||||
description: 'Force push to registries (even from main branch)'
|
||||
required: false
|
||||
default: false
|
||||
type: boolean
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
@@ -47,7 +54,7 @@ jobs:
|
||||
|
||||
# Login to DockerHub
|
||||
- name: Login to DockerHub
|
||||
if: github.event_name != 'pull_request'
|
||||
if: github.event_name != 'pull_request' && (github.ref != 'refs/heads/main' || github.event.inputs.force_push == 'true' || startsWith(github.ref, 'refs/tags/'))
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
@@ -55,7 +62,7 @@ jobs:
|
||||
|
||||
# Login to GitHub Container Registry
|
||||
- name: Login to GitHub Container Registry
|
||||
if: github.event_name != 'pull_request'
|
||||
if: github.event_name != 'pull_request' && (github.ref != 'refs/heads/main' || github.event.inputs.force_push == 'true' || startsWith(github.ref, 'refs/tags/'))
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
@@ -68,7 +75,8 @@ jobs:
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
# Only push if not a PR AND (not main branch OR manual force OR tagged release)
|
||||
push: ${{ github.event_name != 'pull_request' && (github.ref != 'refs/heads/main' || github.event.inputs.force_push == 'true' || startsWith(github.ref, 'refs/tags/')) }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
|
||||
Reference in New Issue
Block a user