mirror of
https://github.com/plexguide/Huntarr.io.git
synced 2026-04-20 13:16:53 -04:00
68 lines
1.8 KiB
YAML
68 lines
1.8 KiB
YAML
name: Docker Build and Push
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- dev
|
|
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 }}
|
|
|
|
# 5a) 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/4sonarr:latest
|
|
huntarr/4sonarr:py-latest
|
|
huntarr/4sonarr:${{ github.sha }}
|
|
|
|
# 5b) 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/4sonarr:dev
|
|
huntarr/4sonarr:py-dev
|
|
huntarr/4sonarr:${{ github.sha }}
|
|
|
|
# 5c) Just build on pull requests
|
|
- name: Build (PR)
|
|
if: github.event_name == 'pull_request'
|
|
uses: docker/build-push-action@v3
|
|
with:
|
|
context: .
|
|
push: false |