-
Notifications
You must be signed in to change notification settings - Fork 35
117 lines (101 loc) · 3.37 KB
/
Copy pathpublish-helm-charts.yml
File metadata and controls
117 lines (101 loc) · 3.37 KB
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
name: Publish Helm Charts
on:
# Run on all pushes to main
push:
branches:
- main
paths:
- 'charts/**'
# Manual trigger
workflow_dispatch:
jobs:
validate-chart-versions:
uses: ./.github/workflows/validate-chart-versions.yml
with:
base_ref: HEAD~1
enforce_version_bump: true
test-charts:
runs-on: ubuntu-latest
needs: [validate-chart-versions]
strategy:
matrix:
chart:
- name: runtime-api
path: charts/runtime-api
- name: image-loader
path: charts/image-loader
- name: openhands
path: charts/openhands
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Helm
uses: azure/setup-helm@v3
with:
version: 'latest'
- name: Test ${{ matrix.chart.name }} chart with default values
run: |
echo "Testing ${{ matrix.chart.name }} chart with default values"
echo "Updating dependencies for ${{ matrix.chart.name }}"
helm dependency update ${{ matrix.chart.path }}
echo "Running helm lint for ${{ matrix.chart.name }}"
helm lint ${{ matrix.chart.path }}
if [ $? -ne 0 ]; then
echo "Helm lint test failed for ${{ matrix.chart.name }}"
exit 1
fi
echo "Helm lint test passed for ${{ matrix.chart.name }}"
echo "Running helm template for ${{ matrix.chart.name }}"
helm template ${{ matrix.chart.path }} --debug
if [ $? -ne 0 ]; then
echo "Helm template test failed for ${{ matrix.chart.name }}"
exit 1
fi
echo "Helm template test passed for ${{ matrix.chart.name }}"
publish-charts:
runs-on: ubuntu-latest
needs: test-charts
permissions:
contents: read
packages: write
strategy:
matrix:
chart:
- name: runtime-api
path: charts/runtime-api
- name: image-loader
path: charts/image-loader
- name: openhands
path: charts/openhands
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Helm
uses: azure/setup-helm@v3
with:
version: 'latest'
- name: Extract chart version and prepare repository
id: chart_info
run: |
VERSION=$(grep '^version:' ${{ matrix.chart.path }}/Chart.yaml | awk '{print $2}')
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
echo "Using chart version: ${VERSION}"
# Convert repository owner to lowercase for GHCR
REPO_OWNER=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')
echo "REPO_OWNER=${REPO_OWNER}" >> $GITHUB_OUTPUT
echo "Using repository owner: ${REPO_OWNER}"
- name: Publish ${{ matrix.chart.name }} chart to GHCR
uses: appany/helm-oci-chart-releaser@v0.4.2
with:
name: ${{ matrix.chart.name }}
repository: helm-charts
path: ${{ matrix.chart.path }}
registry: ghcr.io/${{ steps.chart_info.outputs.REPO_OWNER }}
registry_username: ${{ github.actor }}
registry_password: ${{ secrets.GITHUB_TOKEN }}
update_dependencies: 'true'
tag: ${{ steps.chart_info.outputs.VERSION }}