-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (97 loc) · 3.03 KB
/
publish.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
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: ''
build-and-push-devices:
runs-on: ubuntu-latest
strategy:
# TODO generate matrix
matrix:
module: [raspberrypi3b, raspberrypi5]
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: build-and-push-devices
strategy:
matrix:
# TODO generate list of modules
module: [raspberrypi3b, raspberrypi5]
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