-
Notifications
You must be signed in to change notification settings - Fork 0
135 lines (115 loc) · 3.83 KB
/
build-container-and-charts.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
name: publish
on:
push:
# Trigger CI on all branch pushes but...
branches:
- "**"
# don't double trigger on new tag push when creating release. Should only
# trigger once for the release.
tags-ignore:
- "*.*.*"
pull_request:
release:
types: [created]
jobs:
publish-to-ghcr:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: 'true'
- name: Login to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Docker meta relay
id: meta-relay
uses: docker/metadata-action@v3
with:
images: ghcr.io/${{ github.repository_owner }}/relay
tags: |
type=ref,event=branch
type=ref,event=pr
type=match,pattern=v(.*),group=1
- name: Docker meta flywheel
id: meta-flywheel
uses: docker/metadata-action@v3
with:
images: ghcr.io/${{ github.repository_owner }}/flywheel
tags: |
type=ref,event=branch
type=ref,event=pr
type=match,pattern=v(.*),group=1
- name: Docker meta endpoint
id: meta-endpoint
uses: docker/metadata-action@v3
with:
images: ghcr.io/${{ github.repository_owner }}/baker-endpoint
tags: |
type=ref,event=branch
type=ref,event=pr
type=match,pattern=v(.*),group=1
- name: Push flashbake endpoint container to GHCR
uses: docker/build-push-action@v2
with:
push: true
tags: ${{ steps.meta-endpoint.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
file: Dockerfile.baker-endpoint
- name: Push flashbake relay container to GHCR
uses: docker/build-push-action@v2
with:
push: true
tags: ${{ steps.meta-relay.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
file: Dockerfile.relay
- name: Push flashbake flywheel container to GHCR
uses: docker/build-push-action@v2
with:
push: true
tags: ${{ steps.meta-flywheel.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
file: Dockerfile.flywheel
lint_helm_charts:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Helm
uses: azure/setup-helm@v1
with:
version: v3.8.1
- name: Lint Helm Charts
run: helm lint helm/*
publish_helm_charts:
runs-on: ubuntu-latest
needs: [lint_helm_charts, publish-to-ghcr]
if: github.event_name == 'release' && github.event.action == 'created'
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install yq
run: |
sudo wget -q https://github.com/mikefarah/yq/releases/download/v4.2.0/yq_linux_amd64 -O /usr/bin/yq
sudo chmod +x /usr/bin/yq
- name: Get Release Version
id: get_release_version
run: echo "::set-output name=RELEASE_VERSION::${GITHUB_REF/refs\/tags\//}"
- name: Set Helm Chart and Image Versions
run: |
set -x
RELEASE_VERSION=$(echo ${{ steps.get_release_version.outputs.RELEASE_VERSION }} | sed -e s/v//)
[[ ! -d "$chart" ]] && continue
for chart in helm/*; do
echo $chart
# Update Chart.yaml with release version
yq e ".version = \"$RELEASE_VERSION\"" -i "$chart/Chart.yaml"
# Update tag version in default values.yaml
yq e ".image.tag = \"$RELEASE_VERSION\"" -i $chart/values.yaml
done
- name: Publish Helm charts
uses: stefanprodan/helm-gh-pages@master
with:
linting: off # We already linted in a job before
token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
charts_dir: helm