diff --git a/.github/workflows/lint-helm-chart.yml b/.github/workflows/lint-helm-chart.yml new file mode 100644 index 0000000000..fd733a6cc9 --- /dev/null +++ b/.github/workflows/lint-helm-chart.yml @@ -0,0 +1,45 @@ +name: Lint Helm Chart + +on: + pull_request: + paths: + - examples/kubernetes/firecrawl-helm/** + - .github/workflows/lint-helm-chart.yml + workflow_dispatch: + +permissions: + contents: read + +jobs: + lint: + name: Lint and Template + runs-on: blacksmith-2vcpu-ubuntu-2404 + defaults: + run: + working-directory: ./examples/kubernetes/firecrawl-helm + steps: + - name: Checkout + uses: actions/checkout@v5 + + - name: Install Helm + uses: azure/setup-helm@v4 + with: + version: v3.15.4 + + - name: Helm lint (base values) + run: helm lint . -f values.yaml + + - name: Helm template (base values) + run: helm template firecrawl . -f values.yaml -n firecrawl > /dev/null + + - name: Helm lint (prod overlay) + run: | + if [ -f overlays/prod/values.yaml ]; then + helm lint . -f values.yaml -f overlays/prod/values.yaml + fi + + - name: Helm template (prod overlay) + run: | + if [ -f overlays/prod/values.yaml ]; then + helm template firecrawl . -f values.yaml -f overlays/prod/values.yaml -n firecrawl > /dev/null + fi diff --git a/.github/workflows/release-helm-chart.yml b/.github/workflows/release-helm-chart.yml new file mode 100644 index 0000000000..48758e766d --- /dev/null +++ b/.github/workflows/release-helm-chart.yml @@ -0,0 +1,101 @@ +name: Release Helm Chart + +on: + push: + branches: + - main + paths: + - examples/kubernetes/firecrawl-helm/Chart.yaml + - examples/kubernetes/firecrawl-helm/** + - .github/workflows/release-helm-chart.yml + workflow_dispatch: + inputs: + version: + description: "Override chart version (optional). Leave empty to use Chart.yaml." + required: false + +permissions: + contents: read + packages: write + +jobs: + release: + name: Package and Push Chart to GHCR + runs-on: blacksmith-2vcpu-ubuntu-2404 + defaults: + run: + working-directory: ./examples/kubernetes/firecrawl-helm + steps: + - name: Checkout + uses: actions/checkout@v5 + + - name: Install Helm + uses: azure/setup-helm@v4 + with: + version: v3.15.4 + + - name: Lowercase Repo Owner + run: echo "REPO_OWNER=${GITHUB_REPOSITORY_OWNER,,}" >> "$GITHUB_ENV" + env: + GITHUB_REPOSITORY_OWNER: ${{ github.repository_owner }} + + - name: Resolve chart version + id: chart + run: | + if [ -n "${{ inputs.version }}" ]; then + VERSION="${{ inputs.version }}" + else + VERSION=$(awk '/^version:/ {print $2}' Chart.yaml) + fi + echo "version=${VERSION}" >> "$GITHUB_OUTPUT" + echo "Chart version: ${VERSION}" + + - name: Check if chart version already published + id: check + run: | + if helm show chart oci://ghcr.io/${REPO_OWNER}/charts/firecrawl \ + --version "${{ steps.chart.outputs.version }}" >/dev/null 2>&1; then + echo "exists=true" >> "$GITHUB_OUTPUT" + echo "Chart version ${{ steps.chart.outputs.version }} already published; skipping." + else + echo "exists=false" >> "$GITHUB_OUTPUT" + fi + + - name: Lint chart + if: steps.check.outputs.exists != 'true' + run: helm lint . + + - name: Package chart + if: steps.check.outputs.exists != 'true' + run: helm package . --destination /tmp/helm-packages + + - name: Login to GHCR + if: steps.check.outputs.exists != 'true' + run: echo "${{ secrets.GITHUB_TOKEN }}" | helm registry login ghcr.io -u "${{ github.actor }}" --password-stdin + + - name: Push chart to GHCR + if: steps.check.outputs.exists != 'true' + run: | + helm push /tmp/helm-packages/firecrawl-${{ steps.chart.outputs.version }}.tgz \ + oci://ghcr.io/${REPO_OWNER}/charts + + - name: Summary + if: steps.check.outputs.exists != 'true' + run: | + { + echo "### Helm chart published" + echo "" + echo "Pulled with:" + echo "" + echo '```bash' + echo "helm pull oci://ghcr.io/${REPO_OWNER}/charts/firecrawl --version ${{ steps.chart.outputs.version }}" + echo '```' + echo "" + echo "Installed with:" + echo "" + echo '```bash' + echo "helm upgrade --install firecrawl oci://ghcr.io/${REPO_OWNER}/charts/firecrawl \\" + echo " --version ${{ steps.chart.outputs.version }} \\" + echo " -n firecrawl --create-namespace" + echo '```' + } >> "$GITHUB_STEP_SUMMARY" diff --git a/examples/kubernetes/firecrawl-helm/README.md b/examples/kubernetes/firecrawl-helm/README.md index 5cdf1f34b0..8695409d87 100644 --- a/examples/kubernetes/firecrawl-helm/README.md +++ b/examples/kubernetes/firecrawl-helm/README.md @@ -90,21 +90,54 @@ docker buildx build --platform linux/amd64,linux/arm64 --push \ ../../../apps/nuq-postgres ``` -## Package and Push Helm Chart (OCI) +## Install from GHCR (Public OCI Registry) + +The chart is published to GitHub Container Registry as an OCI artifact by the +`Release Helm Chart` workflow on every merge to `main` that bumps +`Chart.yaml`'s `version`. + +Install directly (no `helm repo add` needed — Helm 3.8+ supports OCI natively). +The chart's bundled `values.yaml` is applied automatically; you almost always +want to layer your own overrides on top for API keys, image pull secrets, +resource limits, etc. + +Quick start (accepts all chart defaults — fine for kicking the tyres, **not** +production-ready since secrets are empty): ```bash -HELM_NO_PLUGINS=1 helm package . --destination /tmp/helm-packages -HELM_NO_PLUGINS=1 helm push /tmp/helm-packages/firecrawl-0.2.0.tgz oci://registry-1.docker.io/winkkgmbh +helm upgrade --install firecrawl oci://ghcr.io/budecosystem/charts/firecrawl \ + --version 0.2.0 \ + -n firecrawl --create-namespace ``` -Install from OCI: +Recommended (supply your own values file, e.g. a copy of `overlays/prod/values.yaml`): ```bash -HELM_NO_PLUGINS=1 helm upgrade --install firecrawl oci://registry-1.docker.io/winkkgmbh/firecrawl \ +# Inspect default values so you know what to override: +helm show values oci://ghcr.io/budecosystem/charts/firecrawl --version 0.2.0 > my-values.yaml + +# Edit my-values.yaml, then install: +helm upgrade --install firecrawl oci://ghcr.io/budecosystem/charts/firecrawl \ --version 0.2.0 \ -n firecrawl --create-namespace \ - -f values.yaml \ - -f overlays/prod/values.yaml + -f my-values.yaml +``` + +Pull the chart archive locally if you want to render templates offline: + +```bash +helm pull oci://ghcr.io/budecosystem/charts/firecrawl --version 0.2.0 +``` + +## Package and Push Helm Chart (Manual) + +The `Release Helm Chart` GitHub workflow publishes to GHCR automatically. Use +the steps below only for ad-hoc publishing to a different OCI registry: + +```bash +HELM_NO_PLUGINS=1 helm package . --destination /tmp/helm-packages +HELM_NO_PLUGINS=1 helm push /tmp/helm-packages/firecrawl-0.2.0.tgz \ + oci:/// ``` ## Test