Skip to content

v2.9.3 (#1222)

v2.9.3 (#1222) #2213

Workflow file for this run

name: Docker
on:
schedule:
- cron: '31 22 * * 0'
push:
branches: [main, dev]
# Publish semver tags as releases.
tags: ['v*.*.*']
pull_request:
branches: [main]
workflow_dispatch:
jobs:
prebuild:
runs-on: ubuntu-latest
steps:
- name: Should build?
run: |
if [ -z "${{ secrets.DOCKERHUB_USERNAME }}" ]; then
echo "The DOCKERHUB_USERNAME secret is missing."
exit 1
fi
build:
needs: [prebuild]
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
strategy:
matrix:
dockerfile: ['multiarch', 'hwaccel', 'qsv']
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: matrix image type
id: image_type
run: |
echo "suffix=${{ matrix.dockerfile == 'hwaccel' && '-hw' || matrix.dockerfile == 'qsv' && '-qsv' ||'' }}" >> $GITHUB_OUTPUT
echo "platforms=${{ matrix.dockerfile == 'multiarch' && 'linux/amd64,linux/arm64,linux/arm/v7' || 'linux/amd64' }}" >> $GITHUB_OUTPUT
echo "arch=${{ matrix.dockerfile == 'multiarch' && 'amd64,armhf,aarch64' || 'amd64' }}" >> $GITHUB_OUTPUT
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: ${{ steps.image_type.outputs.platforms }}
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@master
with:
platforms: ${{ steps.image_type.outputs.platforms }}
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Log into registry ghcr.io
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ github.repository_owner }}/wyze-bridge
ghcr.io/${{ github.repository }}
flavor: |
latest=auto
suffix=${{ steps.image_type.outputs.suffix }},onlatest=true
tags: |
type=schedule,suffix=${{ steps.image_type.outputs.suffix }}
type=semver,pattern={{ version }},suffix=${{ steps.image_type.outputs.suffix }}
type=edge,branch=main,enable=${{ github.event_name == 'push' }},suffix=${{ steps.image_type.outputs.suffix }}
type=ref,event=branch,enable=${{ contains(github.ref,'dev') }},suffix=${{ steps.image_type.outputs.suffix }}
- name: Update Release Version
id: version_bump
if: startsWith(github.ref, 'refs/tags/v')
run: |
TAG_NAME=${GITHUB_REF##*/v}
echo "TAG_NAME: $TAG_NAME"
if [[ $TAG_NAME =~ ^[0-9]+\.[0-9]+\.[0-9]+(-.*)?$ ]]; then
sed -i "s/^VERSION=.*/VERSION=${TAG_NAME}/" ./app/.env
echo "Updated VERSION in app/.env to $TAG_NAME"
fi
- name: Build and push a Docker image
uses: docker/build-push-action@v5
with:
builder: ${{ steps.buildx.outputs.name }}
push: ${{ github.event_name != 'pull_request' }}
context: .
file: ./docker/Dockerfile.${{ matrix.dockerfile }}
platforms: ${{ steps.image_type.outputs.platforms }}
build-args: |
BUILD=${{ steps.meta.outputs.VERSION }}
BUILD_DATE=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }}
GITHUB_SHA=${{ github.sha }}
labels: |
${{ steps.meta.outputs.labels }}
io.hass.name=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.title'] }}
io.hass.description=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.description'] }}
io.hass.version=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
io.hass.type=addon
io.hass.arch=${{ steps.image_type.outputs.arch }}
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha,scope=${{ matrix.dockerfile }}
cache-to: type=gha,mode=max,scope=${{ matrix.dockerfile }}
provenance: false
version_bump:
needs: [build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Update Release Version
id: version_bump
if: startsWith(github.ref, 'refs/tags/v')
run: |
TAG_NAME=${GITHUB_REF##*/v}
if [[ $TAG_NAME =~ ^[0-9]+\.[0-9]+\.[0-9]+(-.*)?$ ]]; then
sed -i "s/^VERSION=.*/VERSION=${TAG_NAME}/" ./app/.env
sed -i "s/^version: .*/version: ${TAG_NAME}/" ./home_assistant/config.yml
echo "tag=${TAG_NAME}" >> $GITHUB_OUTPUT
fi
- name: Commit and push changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
branch: main
commit_message: 'Bump Version to v${{ steps.version_bump.outputs.tag }}'
file_pattern: 'app/.env home_assistant/config.yml'