-
Notifications
You must be signed in to change notification settings - Fork 0
100 lines (91 loc) · 3.11 KB
/
build-push-artifacts.yml
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
# Adapted from https://github.com/stackhpc/azimuth/blob/master/.github/workflows/build-push-artifacts.yaml
name: Publish artifacts
# Run the tasks on every push
# TODO: Add path filtering to only run on relevant changes
on: push
jobs:
# Job to run change detection
changes:
name: Check for relevant changes
runs-on: ubuntu-latest
# Required permissions
permissions:
pull-requests: read
# Set job outputs to values from filter step
outputs:
images: ${{ steps.filter.outputs.images }}
chart: ${{ steps.filter.outputs.chart }}
steps:
- name: Check out the repository
uses: actions/checkout@v4
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
images:
- 'images/**'
chart:
- 'chart/**'
# Job to build container images
build_push_images:
name: Build and push images
runs-on: ubuntu-latest
needs: changes
if: ${{ needs.changes.outputs.images == 'true' }}
strategy:
matrix:
include:
# - component: api
- component: ui
steps:
- name: Check out the repository
uses: actions/checkout@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Calculate metadata for image
id: image-meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/stackhpc/azimuth-llm-${{ matrix.component }}-base
# Produce the branch name or tag and the SHA as tags
tags: |
type=ref,event=branch
type=ref,event=tag
type=sha,prefix=
- name: Build and push image
uses: stackhpc/github-actions/docker-multiarch-build-push@allow-continue-after-scan
with:
cache-key: ${{ matrix.component }}-base
context: ./images/${{ matrix.component }}-base
platforms: linux/amd64 #,linux/arm64
push: true
tags: ${{ steps.image-meta.outputs.tags }}
labels: ${{ steps.image-meta.outputs.labels }}
fail_on_high_severity_cve: false
# Job to build and publish Helm chart
build_push_chart:
name: Build and push Helm chart
runs-on: ubuntu-latest
# Only build and push the chart if chart files have changed
needs: [changes]
if: ${{ needs.changes.outputs.chart == 'true' }}
steps:
- name: Check out the repository
uses: actions/checkout@v4
with:
# This is important for the semver action to work correctly
# when determining the number of commits since the last tag
fetch-depth: 0
- name: Get SemVer version for current commit
id: semver
uses: stackhpc/github-actions/semver@master
- name: Publish Helm charts
uses: stackhpc/github-actions/helm-publish@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: ${{ steps.semver.outputs.version }}
app-version: ${{ steps.semver.outputs.short-sha }}