Skip to content

Add support for DS-K1T343MWX #61

Add support for DS-K1T343MWX

Add support for DS-K1T343MWX #61

Workflow file for this run

# This workflow will publish the Docker image built in a previous job on Github container registry
name: Deploy Docker image
on:
push:
tags:
- "doorbell-v*"
jobs:
# Remove the prefix `doorbell-v` from the Git tag and set it as output of this step
extract-version:
name: Extract version from tag
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
version: ${{ steps.extract_version.outputs.version }}
steps:
- name: Extract version
id: extract_version
run: |
echo ${{ github.ref_name }} | sed -nr 's/doorbell-v(.*)/version=\1/p' >> $GITHUB_OUTPUT
docker-image_amd64:
name: Docker image (amd64)
runs-on: ubuntu-latest
needs: ["extract-version"]
permissions:
packages: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
# list of Docker images to use as base name for tags
images: |
ghcr.io/${{ github.repository_owner }}/hikvision-doorbell
# generate Docker tags based on the following events/attributes
tags: |
# define match group
type=match,pattern=doorbell-v(.*),group=1
# Append architecture to generated tag
# Disable latest tag
flavor: |
latest=false
suffix=-amd64
labels: |
org.opencontainers.image.title=Hikvision Doorbell
# Custom label required by Home Assistant supervisor
#https://developers.home-assistant.io/docs/add-ons/configuration?_highlight=add&_highlight=on&_highlight=label#add-on-dockerfile
io.hass.version=${{ needs.extract-version.outputs.version }}
io.hass.type=addon
io.hass.arch=amd64
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and export
uses: docker/build-push-action@v4
with:
context: ./hikvision-doorbell
file: ./hikvision-doorbell/Dockerfile
build-args: |
BUILD_ARCH=amd64
push: true
platforms: linux/amd64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# Disable provenance, since it creates problem with docker manifests
# https://github.com/docker/build-push-action/releases/tag/v4.0.0
provenance: false
docker-image_aarch64:
name: Docker image (aarch64)
runs-on: ubuntu-latest
needs: ["extract-version"]
permissions:
packages: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
# list of Docker images to use as base name for tags
images: |
ghcr.io/${{ github.repository_owner }}/hikvision-doorbell
# generate Docker tags based on the following events/attributes
tags: |
# define match group
type=match,pattern=doorbell-v(.*),group=1
# Append architecture to generated tag
# Disable latest tag
flavor: |
latest=false
suffix=-aarch64
labels: |
org.opencontainers.image.title=Hikvision Doorbell
# Custom label required by Home Assistant supervisor
#https://developers.home-assistant.io/docs/add-ons/configuration?_highlight=add&_highlight=on&_highlight=label#add-on-dockerfile
io.hass.version=${{ needs.extract-version.outputs.version }}
io.hass.type=addon
io.hass.arch=aarch64
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and export
uses: docker/build-push-action@v4
with:
context: ./hikvision-doorbell
file: ./hikvision-doorbell/Dockerfile
build-args: |
BUILD_ARCH=aarch64
push: true
platforms: linux/aarch64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# Disable provenance, since it creates problem with docker manifests
# https://github.com/docker/build-push-action/releases/tag/v4.0.0
provenance: false
update-manifest:
name: Update Docker image manifest
runs-on: ubuntu-latest
needs: [extract-version, docker-image_amd64, docker-image_aarch64]
permissions:
packages: write
steps:
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Update image manifest and push it
run: |
VERSION=${{ needs.extract-version.outputs.version }}
echo VERSION=$VERSION
# Create a single manifest from the two images
docker manifest create \
ghcr.io/${{ github.repository_owner }}/hikvision-doorbell:$VERSION \
--amend ghcr.io/${{ github.repository_owner }}/hikvision-doorbell:$VERSION-amd64 \
--amend ghcr.io/${{ github.repository_owner }}/hikvision-doorbell:$VERSION-aarch64
# Push the updated manifest
docker manifest push ghcr.io/${{ github.repository_owner }}/hikvision-doorbell:$VERSION