added DS-K1T671MF #11
Workflow file for this run
This file contains 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
# This workflow will publish the Docker image on Dockerhub registry | |
name: Deploy Docker image on Dockerhub | |
on: | |
#release: | |
# types: [published] | |
push: | |
tags: | |
- "doorbell-v[0-9]+.[0-9]+.[0-9]+" | |
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: | | |
${{ secrets.DOCKERHUB_USERNAME }}/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 Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_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: | | |
${{ secrets.DOCKERHUB_USERNAME }}/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 Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_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 Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_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 \ | |
${{ secrets.DOCKERHUB_USERNAME }}/hikvision-doorbell:latest \ | |
--amend ${{ secrets.DOCKERHUB_USERNAME }}/hikvision-doorbell:$VERSION-amd64 \ | |
--amend ${{ secrets.DOCKERHUB_USERNAME }}/hikvision-doorbell:$VERSION-aarch64 | |
# Push the updated manifest | |
docker manifest push ${{ secrets.DOCKERHUB_USERNAME }}/hikvision-doorbell:latest |