-
Notifications
You must be signed in to change notification settings - Fork 7
82 lines (77 loc) · 2.33 KB
/
publish-drivers.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
name: publish-drivers
on:
push:
branches:
- "beta"
- "main"
paths:
- "drivers/**.yaml"
- "drivers/**.yml"
- "drivers/**.lua"
pull_request:
branches:
- main
- beta
types: [opened, synchronize, closed]
paths:
- "drivers/**.yaml"
- "drivers/**.yml"
- "drivers/**.lua"
jobs:
# Job to run change detection
parse-changes:
name: "Parse Push/Pull Changes"
runs-on: ubuntu-latest
# Required permissions
permissions:
pull-requests: read
# Set matched filters as job 'drivers' output variable
outputs:
drivers: ${{ steps.filter.outputs.changes }}
steps:
- name: "Fetching Repository Contents"
uses: actions/checkout@v3
id: checkout
- name: "Filter Paths"
uses: dorny/paths-filter@v2
id: filter
with:
base: ${{ github.base_ref || github.ref_name }}
filters: |
zwave-switch: 'drivers/**/zwave-switch/**'
zwave-fan: 'drivers/**/zwave-fan/**'
zwave-sensor: 'drivers/**/zwave-sensor/**'
matrix-prep:
if: needs.parse-changes.outputs.drivers != '[]'
name: "Create Strategy Matrix"
needs: parse-changes
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: "Fetching Repository Contents"
uses: actions/checkout@v3
id: checkout
- name: "Parse inputFile"
uses: JoshuaTheMiller/conditional-build-matrix@main
id: set-matrix
with:
filter: 'drivers[?contains(`${{ needs.parse-changes.outputs.drivers }}`, driver)]'
publish-drivers:
if: needs.matrix-prep.outputs.matrix != '[]' && (!(contains(github.base_ref, 'main') && github.event.action == 'closed' && github.event.pull_request.merged != true))
needs: matrix-prep
strategy:
matrix: ${{ fromJson(needs.matrix-prep.outputs.matrix) }}
uses: ./.github/workflows/publish-smartthings-driver.yaml
with:
driver: ${{ matrix.driver }}
path: ${{ matrix.path }}
label: ${{ matrix.label }}
pkgkey: ${{ matrix.pkgkey }}
supports: ${{ matrix.supports }}
environment: ${{ github.base_ref || github.ref_name }}
secrets: inherit
release:
needs: publish-drivers
uses: ./.github/workflows/release.yaml
secrets: inherit