tmp #135
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
name: DSMR Reader | |
# Controls when the workflow will run | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- 'master' | |
- 'reader-1.11.1' | |
tags: | |
- '*.*.*' | |
jobs: | |
dsmr-reader: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
# AMD64 | |
- DOCKER_TAG_SUFFIX: amd64 | |
S6_ARCH: amd64 | |
BASE_IMAGE: ghcr.io/xirixiz/dsmr-reader-docker:development | |
PLATFORMS: linux/amd64 | |
QEMU_ARCH: x86_64 | |
# ARM32V6 | |
- DOCKER_TAG_SUFFIX: armhf | |
S6_ARCH: armhf | |
BASE_IMAGE: ghcr.io/xirixiz/dsmr-reader-docker:development | |
PLATFORMS: linux/arm/v6 | |
QEMU_ARCH: arm | |
# ARM32V7 | |
- DOCKER_TAG_SUFFIX: armv7 | |
S6_ARCH: armv7 | |
BASE_IMAGE: ghcr.io/xirixiz/dsmr-reader-docker:development | |
PLATFORMS: linux/arm/v7 | |
QEMU_ARCH: arm | |
# ARM64V8 | |
- DOCKER_TAG_SUFFIX: aarch64 | |
S6_ARCH: aarch64 | |
BASE_IMAGE: ghcr.io/xirixiz/dsmr-reader-docker:development | |
PLATFORMS: linux/arm64/v8 | |
QEMU_ARCH: aarch64 | |
steps: | |
# Get the repository's code | |
- name: Checkout | |
uses: actions/checkout@v3 | |
# 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 "::set-output name=HA_RELEASE::$version" | |
- name: DSMR addon release | |
run: echo ${{ steps.data.outputs.HA_RELEASE }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
# https://github.com/docker/setup-buildx-action | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to Docker Hub | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Docker meta | |
id: meta # you'll use this in the next step | |
uses: docker/metadata-action@v4 | |
with: | |
# list of Docker images to use as base name for tags | |
images: | | |
sanderdw/ha-dsmr-reader-${{ matrix.DOCKER_TAG_SUFFIX }} | |
# Docker tags based on the following events/attributes | |
tags: | | |
type=schedule | |
type=ref,event=branch | |
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 | |
uses: docker/build-push-action@v4 | |
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}} |