Skip to content

chore(smtp): remove unused ALERTS_EMAIL_FROM fallback env var #179

chore(smtp): remove unused ALERTS_EMAIL_FROM fallback env var

chore(smtp): remove unused ALERTS_EMAIL_FROM fallback env var #179

name: Build and Push Docker Image
on:
push:
branches:
- "main"
- "next"
tags:
- "v*"
workflow_dispatch: # Allow manual trigger
inputs:
push_image:
description: "Push image to registry (manual runs only)"
required: false
type: boolean
default: false
no_cache:
description: "Build without cache (fresh build)"
required: false
type: boolean
default: false
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Get version from package.json
id: package-version
run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
- name: Derive major.minor version tag
id: package-version-minor
env:
PKG_VERSION: ${{ steps.package-version.outputs.version }}
run: echo "major_minor=${PKG_VERSION%.*}" >> "$GITHUB_OUTPUT"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Container Registry
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/next' || startsWith(github.ref, 'refs/tags/v') || (github.event_name == 'workflow_dispatch' && inputs.push_image)
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels)
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
annotations: |
org.opencontainers.image.title=Technitium DNS Companion
org.opencontainers.image.description=Web UI to manage and sync multiple Technitium DNS servers (Technitium DNS Companion)
tags: |
# Rolling branch tag — updated on every main push (tracks latest merged code)
type=raw,value=main,enable=${{ github.ref == 'refs/heads/main' }}
# Semver tags derived from package.json version, published only on v* tag pushes
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') }}
type=raw,value=${{ steps.package-version.outputs.version }},enable=${{ startsWith(github.ref, 'refs/tags/v') }}
type=raw,value=${{ steps.package-version-minor.outputs.major_minor }},enable=${{ startsWith(github.ref, 'refs/tags/v') }}
# next branch: rolling beta channel tags
type=raw,value=next,enable=${{ github.ref == 'refs/heads/next' }}
type=raw,value=beta,enable=${{ github.ref == 'refs/heads/next' }}
type=raw,value=${{ steps.package-version.outputs.version }}-beta,enable=${{ github.ref == 'refs/heads/next' }}
# Manual runs: stable name + sha tag (safe for optional pushing)
type=raw,value=manual,enable=${{ github.event_name == 'workflow_dispatch' }}
type=sha,enable=${{ github.event_name == 'workflow_dispatch' }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/next' || startsWith(github.ref, 'refs/tags/v') || (github.event_name == 'workflow_dispatch' && inputs.push_image) }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
annotations: ${{ steps.meta.outputs.annotations }}
build-args: |
BUILD_VERSION=${{ steps.package-version.outputs.version }}
BUILD_REVISION=${{ github.sha }}
cache-from: ${{ inputs.no_cache && '' || 'type=gha' }}
cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm64