Skip to content

update

update #3

Workflow file for this run

name: Docker Build and Push
on:
push:
branches:
- main
- dev
tags:
- "*" # This will trigger on any tag push
pull_request:
branches:
- main
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
# 1) Check out your repository code with full depth
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
# 2) List files to verify huntarr.py is present
- name: List files in directory
run: ls -la
# 3) Set up Docker Buildx
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
# 4) Log in to Docker Hub
- name: Log in to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
# 5) Extract version from tag if it's a tag push
- name: Extract version from tag
if: startsWith(github.ref, 'refs/tags/')
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
# 6a) Build & Push if on 'main' branch
- name: Build and Push (main)
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: |
huntarr/4tdarr:latest
huntarr/4tdarr:${{ github.sha }}
# 6b) Build & Push if on 'dev' branch
- name: Build and Push (dev)
if: github.ref == 'refs/heads/dev' && github.event_name != 'pull_request'
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: |
huntarr/4tdarr:dev
huntarr/4tdarr:${{ github.sha }}
# 6c) Build & Push if it's a tag/release
- name: Build and Push (release)
if: startsWith(github.ref, 'refs/tags/') && github.event_name != 'pull_request'
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: |
huntarr/4tdarr:${{ steps.get_version.outputs.VERSION }}
huntarr/4tdarr:latest
# 6d) Just build on pull requests
- name: Build (PR)
if: github.event_name == 'pull_request'
uses: docker/build-push-action@v3
with:
context: .
push: false