Fix labels #83
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Push Charts | |
on: | |
push: | |
branches: | |
- main | |
env: | |
PUBLIC_REGISTRY: registry.benfu.me/helm | |
INTERNAL_REGISTRY: registry.benfu.me/helm-internal | |
# https://github.com/kubernetes-sigs/kubectl-validate/releases | |
KUBECTL_VALIDATE_VERSION: v0.0.4 | |
jobs: | |
build-push: | |
name: Build and push charts | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
chart: | |
- chart: common | |
registry: public | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Lint | |
run: helm lint charts/${{ matrix.chart.chart }} --strict --debug | |
- name: Build chart | |
run: |- | |
mkdir -p dist/ | |
helm package charts/${{ matrix.chart.chart }} --destination dist/ | |
- name: Extract version | |
id: extract-version | |
run: |- | |
echo "chart-version="$(cat charts/${{ matrix.chart.chart }}/Chart.yaml | yq '.version')"" >> "${GITHUB_OUTPUT}" | |
- name: Login to the helm registry | |
run: |- | |
echo "${HELM_INTERNAL_REGISTRY_PASSWORD}" | helm registry login "${PUBLIC_REGISTRY}" --username "${HELM_INTERNAL_REGISTRY_USERNAME}" --password-stdin | |
echo "${HELM_INTERNAL_REGISTRY_PASSWORD}" | helm registry login "${INTERNAL_REGISTRY}" --username "${HELM_INTERNAL_REGISTRY_USERNAME}" --password-stdin | |
env: | |
HELM_INTERNAL_REGISTRY_USERNAME: ${{ secrets.HELM_INTERNAL_REGISTRY_USERNAME }} | |
HELM_INTERNAL_REGISTRY_PASSWORD: ${{ secrets.HELM_INTERNAL_REGISTRY_PASSWORD }} | |
- name: Push chart | |
if: matrix.chart.registry == 'public' | |
run: |- | |
helm push dist/${{ matrix.chart.chart }}-${{ steps.extract-version.outputs.chart-version }}.tgz "oci://${PUBLIC_REGISTRY}" | |
- name: Push chart | |
if: matrix.chart.registry == 'internal' | |
run: |- | |
helm push dist/${{ matrix.chart.chart }}-${{ steps.extract-version.outputs.chart-version }}.tgz "oci://${INTERNAL_REGISTRY}" |