Skip to content

Commit

Permalink
temp
Browse files Browse the repository at this point in the history
  • Loading branch information
torchiaf committed Jan 4, 2025
1 parent e052101 commit 51810df
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 16 deletions.
24 changes: 8 additions & 16 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,35 +39,27 @@ jobs:
file: controller/Dockerfile
platforms: ''

define-modules-matrix:
define-module-device-matrix:
runs-on: ubuntu-latest

outputs:
modules: ${{ steps.modules.outputs.modules }}
include: ${{ steps.include.outputs.include }}

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Define Modules
id: modules
- name: Define Module Device Matrix
id: include
run: |
echo "modules=$(sh ./scripts/list-directories.sh modules json ^raspberry)" >> $GITHUB_OUTPUT
echo "include=$(sh ./scripts/list-module-device.sh ^raspberry)" >> $GITHUB_OUTPUT
build-and-push-devices:
runs-on: ubuntu-latest
needs: define-modules-matrix
needs: define-module-device-matrix
strategy:
matrix:
## TODO remove this with, dinamically generated
# include:
# - module: raspberrypi3b
# device: dht11
# - module: raspberrypi5
# device: dht11
##
module: ${{ fromJSON(needs.define-modules-matrix.outputs.modules) }}
device: [dht11]
include: ${{ fromJSON(needs.define-module-device-matrix.outputs.include) }}
permissions:
contents: read
packages: write
Expand All @@ -91,7 +83,7 @@ jobs:
build-and-push-modules:
runs-on: ubuntu-latest
needs:
- define-modules-matrix
- define-module-device-matrix
- build-and-push-devices
strategy:
matrix:
Expand Down
17 changes: 17 additions & 0 deletions scripts/list-module-device.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh

REGEX=$1

RET="["

for module in $(ls modules); do
if [ -z "$REGEX" -o $(echo "$module" | grep "$REGEX") ] ; then
for device in $(ls modules/$module/devices); do
RET=$(echo -n "$RET{\"module\":\"$module\",\"device\":\"$device\"},")
done
fi
done

RET=$(echo -n "$(echo -n $RET | sed 's/.$//')]")

echo $RET

0 comments on commit 51810df

Please sign in to comment.