Skip to content

Remove old config

Remove old config #5

Workflow file for this run

name: CRD
on:
push:
branches: [main]
paths:
- 'api/**'
- 'hack/**'
pull_request:
paths:
- 'api/**'
- 'hack/**'
jobs:
generate-crd:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
- name: Install controller-gen
run: go version && go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.14.0
- name: Generate CRD
run: |
controller-gen crd paths=./api/... output:crd:artifacts:config=config/crd/bases
- name: Verify CRD is up to date (PR)
if: github.event_name == 'pull_request'
run: |
git diff --exit-code config/crd || \
(echo "CRD is out of date. Run: task manifests" && exit 1)
- name: Commit and push CRD (push to main)
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: |
git config user.name "github-actions"
git config user.email "github-actions@github.com"
git add config/crd
git diff --staged --quiet || git commit -m "chore: regenerate CRD" && git push
- name: Create MR in helm-charts
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
env:
# Use HELM_CHARTS_TOKEN for cross-repo (PAT with repo scope). If unset, uses GITHUB_TOKEN (works when helm-charts is in same repo).
GH_TOKEN: ${{ secrets.HELM_CHARTS_TOKEN || secrets.GITHUB_TOKEN }}
run: |
set -e
HELM_REPO="dataflow-operator/helm-charts"
BRANCH="crd-sync-$(date +%Y%m%d-%H%M%S)"
mkdir -p helm-charts
git clone "https://x-access-token:${GH_TOKEN}@github.com/${HELM_REPO}.git" helm-charts
cd helm-charts
git config user.name "github-actions"
git config user.email "github-actions@github.com"
mkdir -p charts/dataflow-operator/crds
cp "$GITHUB_WORKSPACE/dataflow/config/crd/bases/dataflow.dataflow.io_dataflows.yaml" charts/dataflow-operator/crds/
git checkout -b "$BRANCH"
git add charts/dataflow-operator/crds
if git diff --staged --quiet; then
echo "CRD unchanged in helm-charts, skipping MR"
exit 0
fi
git commit -m "chore: sync CRD from dataflow-operator"
git push -u origin "$BRANCH"
gh pr create --repo "$HELM_REPO" \
--title "chore: sync CRD from dataflow-operator" \
--body "CRD regenerated from dataflow-operator after api/hack changes."