win-* branches: publish beta tag to Docker Hub and GHCR #2755
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Docker Build and Push | |
| on: | |
| push: | |
| branches: | |
| - '*' # This will trigger on any branch push | |
| tags: | |
| - "*" # This will trigger on any tag push | |
| pull_request: | |
| branches: | |
| - main | |
| permissions: | |
| contents: read | |
| packages: write # Permission to write to GitHub Container Registry | |
| 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 QEMU for multi-architecture builds | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v2 | |
| with: | |
| platforms: arm64,amd64 | |
| # 4) Set up Docker Buildx | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v2 | |
| # 5a) 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 }} | |
| # 5b) Log in to GitHub Container Registry | |
| - name: Log in to GitHub Container Registry | |
| if: github.event_name != 'pull_request' | |
| uses: docker/login-action@v2 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| # 6) Extract metadata (version, branch name, etc.) | |
| - name: Extract metadata | |
| id: meta | |
| run: | | |
| if [[ "${{ github.ref }}" == refs/tags/* ]]; then | |
| VERSION="${GITHUB_REF#refs/tags/}" | |
| echo "VERSION=$VERSION" >> $GITHUB_OUTPUT | |
| echo "IS_TAG=true" >> $GITHUB_OUTPUT | |
| # Beta tags (B-xxx, b-xxx) must NOT overwrite latest - only production releases do | |
| if [[ "$VERSION" =~ ^[Bb]- ]]; then | |
| echo "IS_BETA=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "IS_BETA=false" >> $GITHUB_OUTPUT | |
| fi | |
| else | |
| echo "BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT | |
| echo "IS_TAG=false" >> $GITHUB_OUTPUT | |
| echo "IS_BETA=false" >> $GITHUB_OUTPUT | |
| fi | |
| # 7a) Build & Push if on 'main' branch (only SHA tags, no latest tag) | |
| - 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 | |
| platforms: linux/amd64,linux/arm64 | |
| tags: | | |
| huntarr/huntarr:${{ github.sha }} | |
| ghcr.io/plexguide/huntarr:${{ github.sha }} | |
| # 7b) 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 | |
| platforms: linux/amd64,linux/arm64 | |
| tags: | | |
| huntarr/huntarr:dev | |
| huntarr/huntarr:${{ github.sha }} | |
| ghcr.io/plexguide/huntarr:dev | |
| ghcr.io/plexguide/huntarr:${{ github.sha }} | |
| # 7c) Build & Push - production release tag (v* etc.) → gets VERSION + latest | |
| - name: Build and Push (release - production) | |
| if: steps.meta.outputs.IS_TAG == 'true' && steps.meta.outputs.IS_BETA != 'true' && github.event_name != 'pull_request' | |
| uses: docker/build-push-action@v3 | |
| with: | |
| context: . | |
| push: true | |
| platforms: linux/amd64,linux/arm64 | |
| tags: | | |
| huntarr/huntarr:${{ steps.meta.outputs.VERSION }} | |
| huntarr/huntarr:latest | |
| ghcr.io/plexguide/huntarr:${{ steps.meta.outputs.VERSION }} | |
| ghcr.io/plexguide/huntarr:latest | |
| # 7c-beta) Build & Push - beta tag (B-xxx, b-xxx) → VERSION only, NEVER latest | |
| - name: Build and Push (release - beta) | |
| if: steps.meta.outputs.IS_TAG == 'true' && steps.meta.outputs.IS_BETA == 'true' && github.event_name != 'pull_request' | |
| uses: docker/build-push-action@v3 | |
| with: | |
| context: . | |
| push: true | |
| platforms: linux/amd64,linux/arm64 | |
| tags: | | |
| huntarr/huntarr:${{ steps.meta.outputs.VERSION }} | |
| ghcr.io/plexguide/huntarr:${{ steps.meta.outputs.VERSION }} | |
| # 7d) Build & Push for win-* branches (also publishes beta tag on Docker Hub) | |
| - name: Build and Push (win-* branch → beta) | |
| if: startsWith(github.ref, 'refs/heads/win-') && github.event_name != 'pull_request' | |
| uses: docker/build-push-action@v3 | |
| with: | |
| context: . | |
| push: true | |
| platforms: linux/amd64,linux/arm64 | |
| tags: | | |
| huntarr/huntarr:${{ steps.meta.outputs.BRANCH }} | |
| huntarr/huntarr:beta | |
| huntarr/huntarr:${{ github.sha }} | |
| ghcr.io/plexguide/huntarr:${{ steps.meta.outputs.BRANCH }} | |
| ghcr.io/plexguide/huntarr:beta | |
| ghcr.io/plexguide/huntarr:${{ github.sha }} | |
| # 7e) Build & Push for other feature branches (non-win-*) | |
| - name: Build and Push (feature branch) | |
| if: github.ref != 'refs/heads/main' && github.ref != 'refs/heads/dev' && !startsWith(github.ref, 'refs/heads/win-') && steps.meta.outputs.IS_TAG != 'true' && github.event_name != 'pull_request' | |
| uses: docker/build-push-action@v3 | |
| with: | |
| context: . | |
| push: true | |
| platforms: linux/amd64,linux/arm64 | |
| tags: | | |
| huntarr/huntarr:${{ steps.meta.outputs.BRANCH }} | |
| huntarr/huntarr:${{ github.sha }} | |
| ghcr.io/plexguide/huntarr:${{ steps.meta.outputs.BRANCH }} | |
| ghcr.io/plexguide/huntarr:${{ github.sha }} | |
| # 7f) Just build on pull requests | |
| - name: Build (PR) | |
| if: github.event_name == 'pull_request' | |
| uses: docker/build-push-action@v3 | |
| with: | |
| context: . | |
| push: false | |
| platforms: linux/amd64,linux/arm64 |