Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Release workflows inject github.sha through the GIT_COMMIT build argument.
.git
.github
.devcontainer
Comment thread
matteius marked this conversation as resolved.

build
build-*
cmake-build-*
**/CMakeFiles
**/CMakeCache.txt
**/cmake_install.cmake

**/node_modules
web/dist
playwright-report
test-results

*.deb
*.docx
homeassistant
3 changes: 2 additions & 1 deletion .github/workflows/container-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ jobs:
push: false
load: true
tags: lightnvr:scan
build-args: |
GIT_COMMIT=${{ github.sha }}

- name: Install Trivy
run: |
Expand Down Expand Up @@ -77,4 +79,3 @@ jobs:
name: trivy-scan-results
path: trivy-results.sarif
retention-days: 30

2 changes: 1 addition & 1 deletion .github/workflows/debian-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ jobs:
build-args: |
DEBIAN_SUITE=${{ matrix.debian_suite }}
DEB_BUILD=true
GIT_COMMIT=${{ github.sha }}

- name: Extract files and create .deb package
run: |
Expand Down Expand Up @@ -333,4 +334,3 @@ jobs:
fail_on_unmatched_files: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

22 changes: 16 additions & 6 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,20 @@ env:

jobs:
build:
runs-on: ubuntu-latest
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
platform:
- linux/amd64
- linux/arm64
- linux/arm/v7
include:
- platform: linux/amd64
runner: ubuntu-latest
emulated: false
- platform: linux/arm64
runner: ubuntu-24.04-arm
emulated: false
- platform: linux/arm/v7
runner: ubuntu-latest
emulated: true

steps:
- name: Checkout
Expand Down Expand Up @@ -61,6 +67,7 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up QEMU
if: matrix.emulated
uses: docker/setup-qemu-action@v4

- name: Set up Buildx
Expand All @@ -75,6 +82,10 @@ jobs:
platforms: ${{ matrix.platform }}
pull: true
labels: ${{ steps.meta.outputs.labels }}
build-args: |
GIT_COMMIT=${{ github.sha }}
cache-from: type=registry,ref=${{ env.REGISTRY_IMAGE }}:buildcache-${{ env.PLATFORM_PAIR }}
cache-to: type=registry,ref=${{ env.REGISTRY_IMAGE }}:buildcache-${{ env.PLATFORM_PAIR }},mode=max
outputs: type=image,push-by-digest=true,name=${{ env.REGISTRY_IMAGE }},name-canonical=true,push=true

- name: Save digest
Expand Down Expand Up @@ -161,4 +172,3 @@ jobs:
- name: Inspect final image
run: |
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ CMakeFiles/
cmake_install.cmake
Makefile
*.cmake
!cmake/toolchains/*.cmake
!CMakeLists.txt

# IDE files
Expand Down
30 changes: 21 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -728,15 +728,27 @@ endif()

# Obtain git short commit hash for version stamping
set(GIT_COMMIT "unknown")
find_package(Git QUIET)
if(GIT_FOUND)
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)
if(DEFINED ENV{LIGHTNVR_GIT_COMMIT} AND NOT "$ENV{LIGHTNVR_GIT_COMMIT}" STREQUAL "")
set(GIT_COMMIT_INPUT "$ENV{LIGHTNVR_GIT_COMMIT}")
string(LENGTH "${GIT_COMMIT_INPUT}" GIT_COMMIT_LENGTH)
if(NOT GIT_COMMIT_INPUT MATCHES "^[0-9a-fA-F]+$" OR
GIT_COMMIT_LENGTH LESS 7 OR GIT_COMMIT_LENGTH GREATER 40)
message(FATAL_ERROR
"Invalid LIGHTNVR_GIT_COMMIT: expected a 7-40 character hexadecimal commit")
endif()
string(SUBSTRING "${GIT_COMMIT_INPUT}" 0 7 GIT_COMMIT)
string(TOLOWER "${GIT_COMMIT}" GIT_COMMIT)
else()
find_package(Git QUIET)
if(GIT_FOUND)
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)
endif()
endif()

# Build date in ISO-8601
Expand Down
Loading
Loading