@@ -2,153 +2,98 @@ name: Docker
22
33on :
44 push :
5- branches : [ "main" ]
6- # Publish semver tags as releases.
7- tags : [ 'v*.*.*' ]
5+ branches : ["main"]
6+ tags : ["v*.*.*"]
87 pull_request :
9- branches : [ "main" ]
10-
11- env :
12- REGISTRY : ghcr.io
13- IMAGE_NAME_UI : ${{ github.repository }}-ui
14- IMAGE_NAME_ANSIBLE : ${{ github.repository }}-ansible
8+ branches : ["main"]
159
1610permissions :
1711 contents : write
1812 packages : write
1913 id-token : write
2014
2115jobs :
22- build-ui :
16+ setup :
2317 runs-on : ubuntu-latest
24- permissions :
25- contents : read
26- packages : write
27- id-token : write
18+ outputs :
19+ version : ${{ steps.version.outputs.value }}
2820 steps :
29- - name : Checkout repository
30- uses : actions/checkout@v4
31-
32- - name : Install cosign
33- if : github.event_name != 'pull_request'
34- uses : sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 # v3.5.0
35- with :
36- cosign-release : ' v2.2.4'
37-
38- - name : Set up Docker Buildx
39- uses : docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
40-
41- - name : Log into registry ${{ env.REGISTRY }}
42- if : github.event_name != 'pull_request'
43- uses : docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
44- with :
45- registry : ${{ env.REGISTRY }}
46- username : ${{ github.actor }}
47- password : ${{ secrets.GITHUB_TOKEN }}
48-
49- - name : Set version (SemVer)
50- id : set_version
51- run : echo "VERSION=v0.0.${{ github.run_number }}" >> $GITHUB_ENV
52-
53- - name : Extract Docker UI metadata
54- id : meta-ui
55- uses : docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
56- with :
57- images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_UI }}
58- tags : ${{ env.VERSION }}
59-
60- - name : Build and push UI Docker image
61- id : build-and-push-ui
62- uses : docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
63- with :
64- context : ui/.
65- push : ${{ github.event_name != 'pull_request' }}
66- tags : ${{ steps.meta-ui.outputs.tags }}
67- labels : ${{ steps.meta-ui.outputs.labels }}
68- cache-from : type=gha
69- cache-to : type=gha,mode=max
70-
71- - name : Sign the published UI Docker image
72- if : ${{ github.event_name != 'pull_request' }}
73- env :
74- TAGS : ${{ steps.meta-ui.outputs.tags }}
75- DIGEST : ${{ steps.build-and-push-ui.outputs.digest }}
76- run : echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}
77-
78- build-ansible :
21+ - name : Compute version
22+ id : version
23+ run : |
24+ if [[ "${{ github.ref }}" == refs/tags/v* ]]; then
25+ echo "value=${{ github.ref_name }}" >> $GITHUB_OUTPUT
26+ else
27+ SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
28+ echo "value=sha-${SHORT_SHA}" >> $GITHUB_OUTPUT
29+ fi
30+
31+ quality :
7932 runs-on : ubuntu-latest
80- permissions :
81- contents : read
82- packages : write
83- id-token : write
33+ defaults :
34+ run :
35+ working-directory : ui-next
8436 steps :
85- - name : Checkout repository
86- uses : actions/checkout@v4
87-
88- - name : Install cosign
89- if : github.event_name != 'pull_request'
90- uses : sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 # v3.5.0
91- with :
92- cosign-release : ' v2.2.4'
93-
94- - name : Set up Docker Buildx
95- uses : docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
96-
97- - name : Log into registry ${{ env.REGISTRY }}
98- if : github.event_name != 'pull_request'
99- uses : docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
100- with :
101- registry : ${{ env.REGISTRY }}
102- username : ${{ github.actor }}
103- password : ${{ secrets.GITHUB_TOKEN }}
104-
105- - name : Set version (SemVer)
106- id : set_version
107- run : echo "VERSION=v0.0.${{ github.run_number }}" >> $GITHUB_ENV
108-
109- - name : Extract Docker Ansible metadata
110- id : meta-ansible
111- uses : docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
37+ - uses : actions/checkout@v4
38+ - uses : actions/setup-node@v4
11239 with :
113- images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_ANSIBLE }}
114- tags : ${{ env.VERSION }}
40+ node-version : 22
41+ cache : npm
42+ cache-dependency-path : ui-next/package-lock.json
43+ - name : Install dependencies
44+ run : npm install
45+ - name : Lint
46+ run : npm run lint
47+ - name : Build check
48+ run : npm run build
49+ env :
50+ AUTH_SECRET : ci-placeholder
51+ DATABASE_URL : " :memory:"
11552
116- - name : Build and push Ansible Docker image
117- id : build-and-push-ansible
118- uses : docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
119- with :
120- context : ansible/.
121- push : ${{ github.event_name != 'pull_request' }}
122- tags : ${{ steps.meta-ansible.outputs.tags }}
123- labels : ${{ steps.meta-ansible.outputs.labels }}
124- cache-from : type=gha
125- cache-to : type=gha,mode=max
53+ build-ui :
54+ needs : [setup, quality]
55+ uses : ./.github/workflows/docker-build.yml
56+ with :
57+ image_name : ${{ github.repository }}-ui
58+ context : ui/.
59+ version : ${{ needs.setup.outputs.version }}
60+ registry : ghcr.io
61+ push : ${{ github.event_name != 'pull_request' }}
62+ secrets :
63+ registry_token : ${{ secrets.GITHUB_TOKEN }}
64+
65+ build-ui-next :
66+ needs : [setup, quality]
67+ uses : ./.github/workflows/docker-build.yml
68+ with :
69+ image_name : ${{ github.repository }}-ui-next
70+ context : ui-next/.
71+ version : ${{ needs.setup.outputs.version }}
72+ registry : ghcr.io
73+ push : ${{ github.event_name != 'pull_request' }}
74+ secrets :
75+ registry_token : ${{ secrets.GITHUB_TOKEN }}
12676
127- - name : Sign the published Ansible Docker image
128- if : ${{ github.event_name != 'pull_request' }}
129- env :
130- TAGS : ${{ steps.meta-ansible.outputs.tags }}
131- DIGEST : ${{ steps.build-and-push-ansible.outputs.digest }}
132- run : echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}
77+ build-ansible :
78+ needs : [setup, quality]
79+ uses : ./.github/workflows/docker-build.yml
80+ with :
81+ image_name : ${{ github.repository }}-ansible
82+ context : ansible/.
83+ version : ${{ needs.setup.outputs.version }}
84+ registry : ghcr.io
85+ push : ${{ github.event_name != 'pull_request' }}
86+ secrets :
87+ registry_token : ${{ secrets.GITHUB_TOKEN }}
13388
13489 release :
135- needs : [build-ui, build-ansible]
90+ needs : [build-ui, build-ui-next, build- ansible]
13691 runs-on : ubuntu-latest
13792 permissions :
13893 contents : write
139- packages : write
140- id-token : write
141- if : github.ref == 'refs/heads/main'
94+ if : startsWith(github.ref, 'refs/tags/v')
14295 steps :
143- - name : Set version (SemVer) for release
144- run : echo "VERSION=v0.0.${{ github.run_number }}" >> $GITHUB_ENV
145-
14696 - name : Create GitHub Release
147- uses : actions/create-release@v1
148- env :
149- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
97+ uses : softprops/action-gh-release@v2
15098 with :
151- tag_name : ${{ env.VERSION }}
152- release_name : Release ${{ env.VERSION }}
153- draft : false
154- prerelease : false
99+ generate_release_notes : true
0 commit comments