Skip to content

DSMR Reader 2.1.0 (#131) #209

DSMR Reader 2.1.0 (#131)

DSMR Reader 2.1.0 (#131) #209

Workflow file for this run

name: DSMR Reader
# Controls when the workflow will run
on:
workflow_dispatch:
push:
branches:
- 'main'
- 'reader-*.*.*'
tags:
- '*.*.*'
paths:
- 'dsmr_reader/Dockerfile'
- 'dsmr_reader/rootfs/**'
- .github/workflows/dsmr-reader.yml
jobs:
dsmr-reader:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
attestations: write
id-token: write
strategy:
matrix:
include:
# AMD64
- DOCKER_TAG_SUFFIX: amd64
S6_ARCH: amd64
BASE_IMAGE: ghcr.io/xirixiz/dsmr-reader-docker:6.1.0
PLATFORMS: linux/amd64
QEMU_ARCH: x86_64
# ARM32V7
- DOCKER_TAG_SUFFIX: armv7
S6_ARCH: armv7
BASE_IMAGE: ghcr.io/xirixiz/dsmr-reader-docker:6.1.0
PLATFORMS: linux/arm/v7
QEMU_ARCH: arm
# ARM64V8
- DOCKER_TAG_SUFFIX: aarch64
S6_ARCH: aarch64
BASE_IMAGE: ghcr.io/xirixiz/dsmr-reader-docker:6.1.0
PLATFORMS: linux/arm64/v8
QEMU_ARCH: aarch64
steps:
# Get the repository's code
- name: Checkout
uses: actions/checkout@v6
# https://github.com/docker/setup-qemu-action
- name: Get the version from config.json
id: data
run: |
version=$(jq --raw-output '.version' ./dsmr_reader/config.json)
echo "HA_RELEASE=$version" >> "$GITHUB_OUTPUT"
- name: DSMR addon release
env:
HA_RELEASE: ${{ steps.data.outputs.HA_RELEASE }}
run: echo "$HA_RELEASE"
- name: Set up QEMU
uses: docker/setup-qemu-action@v4
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v4
- name: Log in to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Log in to ghcr.io
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker meta
id: meta # you'll use this in the next step
uses: docker/metadata-action@v6
with:
# list of Docker images to use as base name for tags
images: |
sanderdw/ha-dsmr-reader-${{ matrix.DOCKER_TAG_SUFFIX }}
ghcr.io/${{ github.repository }}/ha-dsmr-reader-${{ matrix.DOCKER_TAG_SUFFIX }}
# Docker tags based on the following events/attributes
tags: |
type=schedule
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=raw,value=${{ steps.data.outputs.HA_RELEASE }}
- name: Build and push
id: push
uses: docker/build-push-action@v7
with:
context: ./dsmr_reader
platforms: ${{ matrix.PLATFORMS }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
BUILD_FROM=${{matrix.BASE_IMAGE}}
HA_RELEASE=${{ steps.data.outputs.HA_RELEASE }}
BUILD_ARCH=${{matrix.S6_ARCH}}
- name: Generate artifact attestation
if: github.ref == 'refs/heads/main'
uses: actions/attest-build-provenance@v4
with:
subject-name: ghcr.io/${{ github.repository }}/ha-dsmr-reader-${{ matrix.DOCKER_TAG_SUFFIX }}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true