-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (49 loc) · 1.66 KB
/
release-helm.yaml
File metadata and controls
58 lines (49 loc) · 1.66 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
name: Release Helm Chart
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Helm
uses: azure/setup-helm@v3
with:
version: 'latest'
- name: Configure Docker for OCI
run: |
echo ${{ secrets.GITHUB_TOKEN }} | helm registry login ghcr.io \
--username ${{ github.actor }} \
--password-stdin
- name: Extract version from tag
id: get_version
run: |
# Remove 'v' prefix from tag
VERSION="${GITHUB_REF#refs/tags/v}"
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
echo "Tag version: ${VERSION}"
- name: Update Chart.yaml with tag version
run: |
# Update the version in Chart.yaml to match the tag
yq eval ".version = \"${{ steps.get_version.outputs.VERSION }}\"" -i Chart.yaml
echo "Updated Chart.yaml version to ${{ steps.get_version.outputs.VERSION }}"
cat Chart.yaml
- name: Package Helm chart
id: package
run: |
helm package .
PACKAGE_FILE=$(ls -t *.tgz | head -n1)
echo "package_file=${PACKAGE_FILE}" >> $GITHUB_OUTPUT
echo "Packaged file: ${PACKAGE_FILE}"
- name: Push to GitHub Container Registry
run: |
REPO_LOWERCASE=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')
helm push "${{ steps.package.outputs.package_file }}" oci://ghcr.io/${REPO_LOWERCASE}