This repository was archived by the owner on Nov 26, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 34
107 lines (89 loc) · 3.98 KB
/
Copy pathpublish-helm-charts.yml
File metadata and controls
107 lines (89 loc) · 3.98 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
name: Publish Helm charts to OCI Registry
on:
push:
branches:
- main
# Publish when a new tag is pushed
tags:
- 'v*'
# Allow manual trigger
workflow_dispatch:
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Helm
uses: azure/setup-helm@v3
with:
version: 'latest'
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up chart-releaser
uses: helm/chart-releaser-action@v1.6.0
with:
install_only: true
- name: Set up tags
run: |
echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
echo "RELEASE_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
# Default version for non-tag builds
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
echo "CHARTS_VERSION=0.0.0-${GITHUB_SHA::8}" >> $GITHUB_ENV
elif [[ "${{ github.ref }}" == refs/tags/v* ]]; then
echo "CHARTS_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
else
echo "CHARTS_VERSION=0.0.0-dev" >> $GITHUB_ENV
fi
- name: Package and push OpenCloud chart
run: |
# Update Chart.yaml version if we have a tag
if [[ "${{ github.ref }}" == refs/tags/v* ]]; then
echo "Updating chart version to ${{ env.CHARTS_VERSION }}"
sed -i "s/^version:.*/version: ${{ env.CHARTS_VERSION }}/" charts/opencloud/Chart.yaml
fi
# Package Helm chart
helm package charts/opencloud
# Push to GHCR
helm push opencloud-*.tgz oci://ghcr.io/${{ github.repository_owner }}/helm-charts/
# Verify the pushed chart
echo "Verifying the pushed chart..."
helm pull oci://ghcr.io/${{ github.repository_owner }}/helm-charts/opencloud --version $(helm show chart charts/opencloud | grep version | awk '{print $2}')
- name: Package and push OpenCloud Dev chart
run: |
# Update Chart.yaml version if we have a tag
if [[ "${{ github.ref }}" == refs/tags/v* ]]; then
echo "Updating chart version to ${{ env.CHARTS_VERSION }}"
sed -i "s/^version:.*/version: ${{ env.CHARTS_VERSION }}/" charts/opencloud-dev/Chart.yaml
fi
# Package Helm chart
helm package charts/opencloud-dev
# Push to GHCR
helm push opencloud-dev-*.tgz oci://ghcr.io/${{ github.repository_owner }}/helm-charts/
# Verify the pushed chart
echo "Verifying the pushed chart..."
helm pull oci://ghcr.io/${{ github.repository_owner }}/helm-charts/opencloud-dev --version $(helm show chart charts/opencloud-dev | grep version | awk '{print $2}')
- name: Package and push OpenCloud Microservice chart
run: |
# Update Chart.yaml version if we have a tag
if [[ "${{ github.ref }}" == refs/tags/v* ]]; then
echo "Updating chart version to ${{ env.CHARTS_VERSION }}"
sed -i "s/^version:.*/version: ${{ env.CHARTS_VERSION }}/" charts/opencloud-microservices/Chart.yaml
fi
# Package Helm chart
helm package charts/opencloud-microservices
# Push to GHCR
helm push opencloud-microservices-*.tgz oci://ghcr.io/${{ github.repository_owner }}/helm-charts/
# Verify the pushed chart
echo "Verifying the pushed chart..."
helm pull oci://ghcr.io/${{ github.repository_owner }}/helm-charts/opencloud-microservices --version $(helm show chart charts/opencloud-microservices | grep version | awk '{print $2}')