forked from kubeflow/trainer
-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (44 loc) · 1.47 KB
/
publish-helm-charts.yaml
File metadata and controls
53 lines (44 loc) · 1.47 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
name: Publish Helm Charts
on:
push:
branches:
- master
tags:
- "v*"
env:
CHART_PATH: charts/kubeflow-trainer
jobs:
publish:
permissions:
contents: read
packages: write
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Update appVersion in Chart.yaml
run: |
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
APP_VERSION="${GITHUB_REF#refs/tags/}"
else
APP_VERSION="sha-$(git rev-parse --short=7 HEAD)"
fi
echo "appVersion: ${APP_VERSION}" >> ${{ env.CHART_PATH }}/Chart.yaml
echo "Updated Chart.yaml with appVersion: ${APP_VERSION}"
- name: Build, package, and push Helm chart
run: |
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
VERSION=$(grep '^version:' ${{ env.CHART_PATH }}/Chart.yaml | awk '{print $2}')
else
VERSION="0.0.0-sha-$(git rev-parse --short=7 HEAD)"
fi
echo "Chart version set to: ${VERSION}"
helm dependency build ${{ env.CHART_PATH }}
helm package ${{ env.CHART_PATH }} --version ${VERSION}
helm push kubeflow-trainer-${VERSION}.tgz oci://ghcr.io/kubeflow/charts