mirror of
https://github.com/cert-manager/webhook-example.git
synced 2026-03-16 18:02:51 +01:00
feat: add helm chart build and publish
This commit is contained in:
parent
a36582be70
commit
b7691ac5e9
2 changed files with 66 additions and 2 deletions
|
|
@ -1,4 +1,8 @@
|
|||
name: 'Build docker image'
|
||||
name: Publish Docker Image to GHCR
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
on:
|
||||
push:
|
||||
60
.github/workflows/publish-helm-chart.yml
vendored
Normal file
60
.github/workflows/publish-helm-chart.yml
vendored
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
name: Publish Helm chart to GHCR
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
env:
|
||||
CHART_DIR: ./deploy/cert-manager-desec-webhook
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Helm
|
||||
uses: azure/setup-helm@v4
|
||||
with:
|
||||
version: 'latest'
|
||||
|
||||
- name: Install yq
|
||||
uses: mikefarah/yq@v4
|
||||
|
||||
- name: Compute chart version
|
||||
id: ver
|
||||
run: |
|
||||
# Version strategy for "push to main":
|
||||
# Use Chart.yaml version + short SHA to avoid collisions.
|
||||
BASE_VERSION="$(yq -r '.version' "${CHART_DIR}/Chart.yaml")"
|
||||
SHORT_SHA="$(git rev-parse --short=8 HEAD)"
|
||||
VERSION="${BASE_VERSION}-${SHORT_SHA}"
|
||||
echo "chart_dir=${CHART_DIR}" >> "$GITHUB_OUTPUT"
|
||||
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Login to GHCR
|
||||
run: |
|
||||
echo "${{ secrets.GITHUB_TOKEN }}" | helm registry login ghcr.io \
|
||||
--username "${{ github.actor }}" \
|
||||
--password-stdin
|
||||
|
||||
- name: Lint chart
|
||||
run: helm lint "${{ steps.ver.outputs.chart_dir }}"
|
||||
|
||||
- name: Package chart
|
||||
run: |
|
||||
helm package "${{ steps.ver.outputs.chart_dir }}" \
|
||||
--version "${{ steps.ver.outputs.version }}" \
|
||||
--destination ./dist
|
||||
|
||||
- name: Push chart to GHCR (OCI)
|
||||
env:
|
||||
OWNER: ${{ github.repository_owner }}
|
||||
run: |
|
||||
helm push ./dist/*.tgz oci://ghcr.io/${OWNER}/helm
|
||||
Loading…
Reference in a new issue