Skip to content

Commit 313403c

Browse files
committed
feat: add CRD tarball as release asset
ci: upgrade action-gh-release to v2.3.2 in release workflow for improved functionality refactor: change CRD packaging from tarball to single YAML file in Makefile and update release workflow accordingly feat: enhance CRD packaging in Makefile to support both yq and manual concatenation methods
1 parent 1e2a7c4 commit 313403c

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

.github/workflows/release.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,31 @@ jobs:
6464
push-image: true
6565
secrets:
6666
GH_PAT: ${{ secrets.GH_PAT }}
67+
68+
upload-crds:
69+
runs-on: ubuntu-24.04
70+
needs: [precheck]
71+
permissions:
72+
contents: write
73+
steps:
74+
- name: Checkout
75+
uses: actions/checkout@v4
76+
with:
77+
fetch-depth: 0
78+
ref: ${{ github.event.release.tag_name }}
79+
80+
- name: Setup Go with private modules
81+
uses: ./.github/actions/setup-go-private
82+
with:
83+
go-version: ${{ env.GO_VERSION }}
84+
gh-token: ${{ secrets.GH_PAT }}
85+
86+
- name: Package CRDs
87+
run: make package-crds VERSION=${{ needs.precheck.outputs.tag }}
88+
89+
- name: Upload CRD Assets
90+
uses: softprops/action-gh-release@v2.3.2
91+
with:
92+
files: |
93+
dist/ui-operator-crds-${{ needs.precheck.outputs.tag }}.yaml
94+
tag_name: ${{ github.event.release.tag_name }}

Makefile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,29 @@ help: ## Display this help.
9898
manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
9999
$(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases
100100

101+
.PHONY: package-crds
102+
package-crds: manifests ## Package CRDs into a single YAML file
103+
mkdir -p dist
104+
@echo "# UI Operator CRDs - Version $(VERSION)" > dist/ui-operator-crds-$(VERSION).yaml
105+
@echo "# Generated on $$(date)" >> dist/ui-operator-crds-$(VERSION).yaml
106+
@if command -v yq >/dev/null 2>&1; then \
107+
echo "Using yq to merge YAML files..."; \
108+
yq eval-all 'select(. != null)' config/crd/bases/*.yaml >> dist/ui-operator-crds-$(VERSION).yaml; \
109+
else \
110+
echo "Using manual YAML concatenation with proper separators..."; \
111+
first=true; \
112+
for file in config/crd/bases/*.yaml; do \
113+
if [ "$$first" = true ]; then \
114+
first=false; \
115+
else \
116+
echo "---" >> dist/ui-operator-crds-$(VERSION).yaml; \
117+
fi; \
118+
echo "# Source: $$(basename $$file)" >> dist/ui-operator-crds-$(VERSION).yaml; \
119+
cat $$file >> dist/ui-operator-crds-$(VERSION).yaml; \
120+
echo "" >> dist/ui-operator-crds-$(VERSION).yaml; \
121+
done; \
122+
fi
123+
101124
.PHONY: generate
102125
generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
103126
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."

0 commit comments

Comments
 (0)