Skip to content

Commit

Permalink
Use OCI for helm charts
Browse files Browse the repository at this point in the history
  • Loading branch information
meln5674 committed Jan 10, 2024
1 parent cfe0865 commit b2770d5
Showing 1 changed file with 23 additions and 28 deletions.
51 changes: 23 additions & 28 deletions .github/workflows/helm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ on:
tags: [ 'v*.*.*' ]

env:
REGISTRY: ghcr.io
CHART_DIR: helm/kink
HELM_REPO: "oci://ghcr.io/${{ github.repository }}/charts"

jobs:
release:
Expand All @@ -31,37 +33,30 @@ jobs:
uses: olegtarasov/[email protected]

- name: Install Helm
uses: azure/setup-helm@v1
with:
version: v3.8.1

- name: Install YQ
uses: chrisdickinson/setup-yq@latest
with:
yq-version: v4.27.2
run:
make helm

- name: Set Chart Version
- name: Lint
run: |
if [ -n "${{ steps.tagName.outputs.tag }}" ]; then
yq -i '.version = "${{ steps.tagName.outputs.tag }}"' '${{ env.CHART_DIR }}/Chart.yaml'
yq -i '.appVersion = "${{ steps.tagName.outputs.tag }}"' '${{ env.CHART_DIR }}/Chart.yaml'
else
yq -i '.version = .version + "-'"${GITHUB_SHA}"'"' '${{ env.CHART_DIR }}/Chart.yaml'
yq -i '.appVersion = "sha-'"${GITHUB_SHA}"'"' '${{ env.CHART_DIR }}/Chart.yaml'
bin/helm lint "${CHART_DIR}"
bin/helm template "${CHART_DIR}"
# Release charts
- name: Push Charts
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
run: |
set -x
bin/helm registry login "${REGISTRY}" -u "${GITHUB_ACTOR}" -p "${GITHUB_TOKEN}"
GIT_TAG="${{ steps.tagName.outputs.tag }}"
if [ -n "${GIT_TAG}" ]; then
NEW_VERSION="${GIT_TAG}"
NEW_APP_VERSION="${GIT_TAG}"
else
NEW_VERSION=""
NEW_APP_VERSION="sha-${GITHUB_SHA}"
fi
make chart CHART_VERSION="${NEW_VERSION}" CHART_APP_VERSION="${NEW_APP_VERSION}" CHART_GIT_SHA="${GITHUB_SHA}"
bin/helm push bin/charts/kink-*.tgz "${HELM_REPO}"
- name: Lint
run: |
helm lint '${{ env.CHART_DIR }}'
helm template '${{ env.CHART_DIR }}'
# Need to do this otherwise it will end up publishing the test chart
rm -rf helm/kink-test
- name: Run chart-releaser
uses: helm/[email protected]
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
with:
charts_dir: helm

0 comments on commit b2770d5

Please sign in to comment.