mirror of
https://github.com/cert-manager/webhook-example.git
synced 2026-03-16 18:02:51 +01:00
Merge pull request #2 from pr0ton11/feat/build-process
Fix build process and add Helm chart release
This commit is contained in:
commit
7dd4f46bb0
3 changed files with 68 additions and 4 deletions
|
|
@ -1,9 +1,13 @@
|
||||||
name: 'Build docker image'
|
name: Publish Docker Image to GHCR
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
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
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
FROM golang:1.25.7 AS build
|
FROM golang:1.25.7 AS build
|
||||||
|
|
||||||
RUN apk add --no-cache git
|
|
||||||
|
|
||||||
WORKDIR /workspace
|
WORKDIR /workspace
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
@ -16,4 +14,6 @@ RUN apk add --no-cache ca-certificates
|
||||||
|
|
||||||
COPY --from=build /workspace/webhook /usr/local/bin/webhook
|
COPY --from=build /workspace/webhook /usr/local/bin/webhook
|
||||||
|
|
||||||
|
RUN chmod +x /usr/local/bin/webhook
|
||||||
|
|
||||||
ENTRYPOINT ["webhook"]
|
ENTRYPOINT ["webhook"]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue