Files
iptvnator/.github/workflows/docker.yml
T
4grayandClaude Fable 5 ec09778f36 feat(about): show build commit next to the app version (#1208)
* feat(about): show build commit next to the app version

Settings > About now renders "<version> (<short-sha>)" with the full
SHA in the tooltip, so bug reports from test and nightly builds
identify the exact commit. The commit is injected at CI build time into
apps/web/src/environments/build-commit.ts (same placeholder pattern as
the TMDB key inject); PR builds use the real head SHA instead of the
ephemeral merge commit. Local/dev builds keep the plain version.

The semver version itself deliberately stays untouched: a "-sha"
suffix would flip electron-updater into prerelease mode and leak into
installer/artifact version fields.

Requested by WolfganP in #1202.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* style(settings): keep relative import after monorepo alias imports

Addresses Greptile feedback on #1208.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* feat(docker): inject build commit into published PWA images

The Docker/PWA build path bypassed the Electron workflow's inject step,
so published images showed the plain version in About. Pass the commit
as a build arg and run the inject script before the PWA build; the
script no-ops when BUILD_COMMIT is empty, leaving local docker builds
unchanged.

Addresses Codex feedback on #1208.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-19 09:44:08 +02:00

116 lines
4.0 KiB
YAML

name: docker-build
on:
pull_request:
paths:
- '.github/workflows/docker.yml'
- 'apps/web/**'
- 'apps/web-backend/**'
- 'docker/**'
- 'libs/**'
- 'package.json'
- 'pnpm-lock.yaml'
push:
branches:
- master
tags:
- 'v*'
workflow_dispatch:
inputs:
push:
description: 'Push the image to Docker Hub'
required: true
type: boolean
default: false
permissions:
contents: read
jobs:
build:
name: Build Docker image
runs-on: ubuntu-latest
timeout-minutes: 90
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Prepare Docker metadata
id: docker-meta
shell: bash
run: |
set -euo pipefail
version="$(node -p "require('./package.json').version")"
short_sha="${GITHUB_SHA::12}"
publish="false"
platforms="linux/amd64"
tags="4gray/iptvnator:pr-${{ github.event.pull_request.number || 'manual' }}"
if [[ "${GITHUB_EVENT_NAME}" == "push" && "${GITHUB_REF}" == "refs/heads/master" ]]; then
publish="true"
platforms="linux/amd64,linux/arm64"
tags=$(cat <<TAGS
4gray/iptvnator:latest
4gray/iptvnator:${version}-pwa
4gray/iptvnator:${version}-pwa-${short_sha}
4gray/iptvnator:sha-${short_sha}
TAGS
)
elif [[ "${GITHUB_EVENT_NAME}" == "push" && "${GITHUB_REF}" == refs/tags/v* ]]; then
publish="true"
platforms="linux/amd64,linux/arm64"
tag_version="${GITHUB_REF_NAME#v}"
tags=$(cat <<TAGS
4gray/iptvnator:${tag_version}
4gray/iptvnator:v${tag_version}
TAGS
)
if [[ "${tag_version}" != *-* ]]; then
tags="${tags}"$'\n'"4gray/iptvnator:stable"
fi
elif [[ "${GITHUB_EVENT_NAME}" == "workflow_dispatch" && "${{ inputs.push }}" == "true" ]]; then
publish="true"
platforms="linux/amd64,linux/arm64"
tags=$(cat <<TAGS
4gray/iptvnator:manual-${short_sha}
4gray/iptvnator:sha-${short_sha}
TAGS
)
fi
{
echo "publish=${publish}"
echo "platforms=${platforms}"
echo "tags<<EOF"
echo "${tags}"
echo "EOF"
} >> "${GITHUB_OUTPUT}"
- name: Login to Docker Hub
if: steps.docker-meta.outputs.publish == 'true'
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Build Docker image
uses: docker/build-push-action@v7
with:
context: .
file: ./docker/Dockerfile
push: ${{ steps.docker-meta.outputs.publish == 'true' }}
tags: ${{ steps.docker-meta.outputs.tags }}
platforms: ${{ steps.docker-meta.outputs.platforms }}
build-args: |
BUILD_COMMIT=${{ github.event.pull_request.head.sha || github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max,ignore-error=true