Skip to content

temp2

temp2 #186

Workflow file for this run

name: Publish
on:
push:
tags:
- v*
branches:
- main
paths:
- 'controller/**'
- 'modules/**'
- 'scripts/**'
- '.github/**'
env:
REGISTRY: ghcr.io
REPO_LC: sensors
jobs:
build-and-push-controller:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Run Build and Publish Docker image
id: controller
uses: ./.github/actions/docker-push
with:
registry: ${{ env.REGISTRY }}
repository_lc: ${{ env.REPO_LC }}
token: ${{ secrets.GITHUB_TOKEN }}
image-name: controller
tag-name: ${{ github.ref_name }}
context: controller
file: controller/Dockerfile
platforms: ''
define-modules-matrix:
runs-on: ubuntu-latest
outputs:
modules: ${{ steps.modules.outputs.modules }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Define Modules
id: modules
run: |
echo "modules=$(sh ./scripts/list-directories.sh modules ^raspberry json)" >> $GITHUB_OUTPUT
build-and-push-devices:
runs-on: ubuntu-latest
needs: define-modules-matrix
strategy:
matrix:
module: ${{ fromJSON(needs.define-modules-matrix.outputs.modules) }}
# TODO generate devices sub matrix & exclude/include
device: [dht11]
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Run Build and Publish Docker image
id: devices
uses: ./.github/actions/docker-push
with:
registry: ${{ env.REGISTRY }}
repository_lc: ${{ env.REPO_LC }}
token: ${{ secrets.GITHUB_TOKEN }}
image-name: device/${{ matrix.device }}
tag-name: ${{ github.ref_name }}-${{ matrix.module }}
context: modules/${{ matrix.module }}/devices/${{ matrix.device }}
file: modules/${{ matrix.module }}/devices/${{ matrix.device }}/Dockerfile
platforms: linux/arm64
build-and-push-modules:
runs-on: ubuntu-latest
needs:
- define-modules-matrix
- build-and-push-devices
strategy:
matrix:
module: ${{ fromJSON(needs.define-modules-matrix.outputs.modules) }}
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Generate Module Device list
id: devices_list
shell: sh
run: echo "devices=$(sh ./scripts/list-directories.sh modules/${{ matrix.module }}/devices)\n" >> $GITHUB_OUTPUT
- name: Generate Module Dockerfile
id: generate_dockerfile
shell: sh
run: sh ./scripts/generate-module-dockerfile.sh ${{ matrix.module }} ${{ steps.devices_list.outputs.devices }} ${{ env.REGISTRY }} ${{ github.repository_owner }} ${{ env.REPO_LC }} ${{ github.ref_name }} modules/${{ matrix.module }}/Dockerfile
- name: Run Build and Publish Docker image
id: modules
uses: ./.github/actions/docker-push
with:
registry: ${{ env.REGISTRY }}
repository_lc: ${{ env.REPO_LC }}
token: ${{ secrets.GITHUB_TOKEN }}
image-name: module/${{ matrix.module }}
tag-name: ${{ github.ref_name }}
context: modules
file: modules/${{ matrix.module }}/Dockerfile
platforms: linux/arm64