1
1
# Adapted from https://github.com/stackhpc/azimuth/blob/master/.github/workflows/build-push-artifacts.yaml
2
2
name : Publish artifacts
3
- # Run the tasks on every push
4
- on : push
5
- jobs :
6
- # Job to run change detection
7
- changes :
8
- name : Check for relevant changes
9
- runs-on : ubuntu-latest
10
- # Required permissions
11
- permissions :
12
- pull-requests : read
13
- # Set job outputs to values from filter step
14
- outputs :
15
- images : ${{ steps.filter.outputs.images }}
16
- chart : ${{ steps.filter.outputs.chart }}
17
- steps :
18
-
19
- - name : Check out the repository
20
- uses : actions/checkout@v4
21
3
22
- - uses : dorny/paths-filter@v2
23
- id : filter
24
- with :
25
- base : ${{ github.ref_name }}
26
- # TODO: Make image filters more granular
27
- filters : |
28
- images:
29
- - 'web-apps/**'
30
- chart:
31
- - 'charts/**'
4
+ on :
5
+ # Publish artifacts on every push to master and every tag
6
+ push :
7
+ branches :
8
+ - master
9
+ tags :
10
+ - " *"
11
+ # Also allow publication to be done via a workflow call
12
+ # In this case, the chart version is returned as an output
13
+ workflow_call :
14
+ inputs :
15
+ ref :
16
+ type : string
17
+ description : The ref to build.
18
+ required : true
19
+ outputs :
20
+ chart-version :
21
+ description : The chart version that was published
22
+ value : ${{ jobs.build_push_chart.outputs.chart-version }}
32
23
33
- # Job to build container images
24
+ jobs :
34
25
build_push_images :
35
26
name : Build and push images
36
27
runs-on : ubuntu-latest
37
- permissions :
38
- contents : read
39
- id-token : write # needed for signing the images with GitHub OIDC Token
40
- packages : write # required for pushing container images
41
- security-events : write # required for pushing SARIF files
42
- needs : changes
43
- # if: ${{ github.ref_type == 'tag' || needs.changes.outputs.images == 'true' }}
44
28
strategy :
45
29
matrix :
46
30
include :
47
31
- component : chat
48
32
- component : image-analysis
33
+ permissions :
34
+ contents : read
35
+ id-token : write # needed for signing the images with GitHub OIDC Token
36
+ packages : write # required for pushing container images
37
+ security-events : write # required for pushing SARIF files
49
38
steps :
50
39
- name : Check out the repository
51
40
uses : actions/checkout@v4
41
+ with :
42
+ ref : ${{ inputs.ref || github.ref }}
52
43
53
44
- name : Login to GitHub Container Registry
54
45
uses : docker/login-action@v3
@@ -57,19 +48,23 @@ jobs:
57
48
username : ${{ github.actor }}
58
49
password : ${{ secrets.GITHUB_TOKEN }}
59
50
51
+ - name : Get SemVer version for current commit
52
+ id : semver
53
+ uses : azimuth-cloud/github-actions/semver@master
54
+
60
55
- name : Calculate metadata for image
61
56
id : image-meta
62
57
uses : docker/metadata-action@v5
63
58
with :
64
- images : ghcr.io/stackhpc /azimuth-llm- ${{ matrix.component }}-ui
59
+ images : ghcr.io/azimuth-cloud /azimuth-${{ matrix.component }}
65
60
# Produce the branch name or tag and the SHA as tags
66
61
tags : |
67
62
type=ref,event=branch
68
63
type=ref,event=tag
69
- type=sha,prefix=
64
+ type=raw,value=${{ steps.semver.outputs.short-sha }}
70
65
71
66
- name : Build and push image
72
- uses : azimuth-cloud/github-actions/docker-multiarch-build-push@test/docker-build-cache
67
+ uses : azimuth-cloud/github-actions/docker-multiarch-build-push@master
73
68
with :
74
69
cache-key : ${{ matrix.component }}
75
70
context : ./web-apps/
@@ -79,17 +74,18 @@ jobs:
79
74
tags : ${{ steps.image-meta.outputs.tags }}
80
75
labels : ${{ steps.image-meta.outputs.labels }}
81
76
82
- # Job to build and publish Helm chart
83
77
build_push_chart :
84
78
name : Build and push Helm chart
85
79
runs-on : ubuntu-latest
86
- # Only build and push the chart if chart files have changed
87
- needs : [changes]
88
- if : ${{ github.ref_type == 'tag' || needs.changes.outputs.chart == 'true' }}
80
+ # Only build and push the chart if the images built successfully
81
+ needs : [build_push_images]
82
+ outputs :
83
+ chart-version : ${{ steps.semver.outputs.version }}
89
84
steps :
90
85
- name : Check out the repository
91
86
uses : actions/checkout@v4
92
87
with :
88
+ ref : ${{ inputs.ref || github.ref }}
93
89
# This is important for the semver action to work correctly
94
90
# when determining the number of commits since the last tag
95
91
fetch-depth : 0
101
97
- name : Publish Helm charts
102
98
uses : azimuth-cloud/github-actions/helm-publish@master
103
99
with :
104
- directory : charts
105
100
token : ${{ secrets.GITHUB_TOKEN }}
106
101
version : ${{ steps.semver.outputs.version }}
107
102
app-version : ${{ steps.semver.outputs.short-sha }}
0 commit comments