From f680bab73e0c040e88bc899208fb107e86ce489c Mon Sep 17 00:00:00 2001 From: Callum Forrester Date: Sat, 1 Jun 2024 21:48:48 +0100 Subject: [PATCH] Add Helm linting and publishing CI --- .github/workflows/helm.yml | 65 ++++++++++++++++++++++++++++++++++++++ .github/workflows/lint.yml | 1 - 2 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/helm.yml diff --git a/.github/workflows/helm.yml b/.github/workflows/helm.yml new file mode 100644 index 0000000..6198479 --- /dev/null +++ b/.github/workflows/helm.yml @@ -0,0 +1,65 @@ +name: Helm CI + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +env: + GCR_IMAGE: ghcr.io/diamondlightsource/logpanel + HELM_VERSION: 3.12.3 + HELM_CHART: helm/logpanel + +jobs: + check: + name: check helm chart + runs-on: ubuntu-latest + # environment: prod + steps: + - name: checkout repo + uses: actions/checkout@v3 + + - name: install helm + uses: Azure/setup-helm@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + id: install + + - name: check chart + run: helm lint ${{ env.HELM_CHART }} + + - name: check depdencies + run: helm dependencies build ${{ env.HELM_CHART }} + + build: + if: github.ref_type == 'tag' + name: publish gcr + runs-on: ubuntu-latest + # environment: prod + steps: + - name: checkout repo + uses: actions/checkout@v3 + + - name: install helm + uses: Azure/setup-helm@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + id: install + + - name: login to acr using helm + run: | + echo ${{ secrets.GITHUB_TOKEN }} | helm registry login ${{ env.GCR_IMAGE }} --username ${{ github.repository_owner }} --password-stdin + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@57396166ad8aefe6098280995947635806a0e6ea + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=ref,event=tag + - name: package chart and push it + run: | + sed -i "$ a appVersion: ${GITHUB_REF##*/}" ${{ env.HELM_CHART }}/Chart.yaml + helm dependencies build ${{ env.HELM_CHART }} + helm package ${{ env.HELM_CHART }} --version ${GITHUB_REF##*/} -d /tmp/ + helm push /tmp/blueapi-${GITHUB_REF##*/}.tgz oci://ghcr.io/diamondlightsource/charts diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index cdab01a..9f62948 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -8,7 +8,6 @@ on: jobs: build: - runs-on: ubuntu-latest strategy: