Skip to content

Commit cb40ad6

Browse files
committed
Fix docker publish-workflow
1 parent 1e0a891 commit cb40ad6

File tree

1 file changed

+42
-22
lines changed

1 file changed

+42
-22
lines changed

.github/workflows/docker-publish.yml

Lines changed: 42 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: Publish daemons
2-
# portions from gemini pro
2+
# portions from gemini pro and fast
33

44
on:
55
schedule:
@@ -26,35 +26,55 @@ env:
2626

2727

2828
jobs:
29+
setup-matrix:
30+
runs-on: ubuntu-latest
31+
outputs:
32+
matrix: ${{ steps.set-matrix.outputs.matrix }}
33+
has_jobs: ${{ steps.set-matrix.outputs.has_jobs }}
34+
steps:
35+
- id: set-matrix
36+
uses: actions/github-script@v7
37+
env:
38+
REF_NAME: ${{ github.ref_name }}
39+
with:
40+
script: |
41+
const allContainers = [
42+
'apphandler',
43+
'authhandler',
44+
'avsdispatcher',
45+
'housekeeping',
46+
'ltihandler',
47+
'notepadhandler',
48+
'noteshandler',
49+
'staticserver'
50+
]
51+
const allContainersWithContext = allContainers.map((container) => ({
52+
container,
53+
context: './daemons/' + container
54+
}))
55+
56+
const isTag = context.ref.startsWith('refs/tags/');
57+
const refName = process.env.REF_NAME;
58+
59+
let activeContainers = allContainersWithContext;
60+
if (isTag) {
61+
activeContainers = allContainersWithContext.filter(c => refName.includes(c.container));
62+
}
63+
64+
core.setOutput('has_jobs', activeContainers.length > 0);
65+
core.setOutput('matrix', JSON.stringify({ include: activeContainers }));
66+
2967
build:
68+
needs: setup-matrix
3069
runs-on: ubuntu-latest
70+
if: ${{ needs.setup-matrix.outputs.has_jobs == 'true' }}
3171
permissions:
3272
contents: read
3373
packages: write
3474

3575
strategy:
3676
fail-fast: false
37-
matrix:
38-
include:
39-
- container: apphandler
40-
context: ./daemons/apphandler
41-
- container: authhandler
42-
context: ./daemons/authhandler
43-
- container: avsdispatcher
44-
context: ./daemons/avsdispatcher
45-
- container: housekeeping
46-
context: ./daemons/housekeeping
47-
- container: ltihandler
48-
context: ./daemons/ltihandler
49-
- container: notepadhandler
50-
context: ./daemons/notepadhandler
51-
- container: noteshandler
52-
context: ./daemons/noteshandler
53-
- container: staticserver
54-
context: ./daemons/staticserver
55-
if: >-
56-
!startsWith(github.ref, 'refs/tags/') ||
57-
contains(github.ref_name, matrix.container)
77+
matrix: ${{ fromJSON(needs.setup-matrix.outputs.matrix) }}
5878

5979
steps:
6080
- name: Checkout repository

0 commit comments

Comments
 (0)