Skip to content

Commit 6322b6e

Browse files
committed
ci: add artifacts target and upload-artifacts job for CRDs (#1713)
Signed-off-by: Cong Liu <conliu@google.com>
1 parent f95e36b commit 6322b6e

2 files changed

Lines changed: 53 additions & 0 deletions

File tree

.github/workflows/ci-release.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,43 @@ jobs:
5151
tag: ${{ needs.set-params.outputs.tag }}
5252
prerelease: ${{ fromJSON(needs.set-params.outputs.prerelease) }}
5353
chart-suffix: ""
54+
55+
upload-artifacts:
56+
needs: set-params
57+
runs-on: ubuntu-latest
58+
permissions:
59+
contents: write
60+
steps:
61+
- name: Checkout source
62+
uses: actions/checkout@v6
63+
64+
- name: Set up Go
65+
uses: actions/setup-go@v5
66+
with:
67+
go-version-file: go.mod
68+
69+
- name: Setup Kubectl
70+
uses: azure/setup-kubectl@v4
71+
with:
72+
version: 'latest'
73+
74+
- name: Build Artifacts
75+
run: |
76+
make artifacts
77+
78+
- name: Upload Release Assets
79+
env:
80+
GITHUB_TOKEN: ${{ github.token }}
81+
run: |
82+
files=$(find artifacts -type f -size +0c | tr '\n' ' ')
83+
if [ -z "$files" ]; then
84+
echo "No artifacts to upload."
85+
exit 0
86+
fi
87+
if gh release view "${{ needs.set-params.outputs.tag }}" >/dev/null 2>&1; then
88+
gh release upload "${{ needs.set-params.outputs.tag }}" $files --clobber
89+
else
90+
echo "Release ${{ needs.set-params.outputs.tag }} does not exist. Creating a draft release..."
91+
gh release create "${{ needs.set-params.outputs.tag }}" $files --draft --title "${{ needs.set-params.outputs.tag }}" --notes "Release ${{ needs.set-params.outputs.tag }}"
92+
fi
93+

Makefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,19 @@ helm-push-standalone: ## Package and push the llm-d-router-standalone Helm chart
359359
$(MAKE) helm-push CHART=llm-d-router-standalone
360360

361361

362+
##@ Release
363+
364+
.PHONY: artifacts
365+
artifacts: yq check-kustomize ## Generate release artifacts (CRD manifests)
366+
if [ -d artifacts ]; then rm -rf artifacts; fi
367+
mkdir -p artifacts
368+
kubectl kustomize config/crd > artifacts/manifests_all.yaml
369+
$(YQ) -P 'select(.spec.group == "llm-d.ai")' artifacts/manifests_all.yaml > artifacts/manifests.yaml
370+
rm -f artifacts/manifests_all.yaml
371+
$(YQ) -P 'select(.spec.versions | map(.name == "v1") | any)' artifacts/manifests.yaml > artifacts/v1-manifests.yaml
372+
$(YQ) -P 'select(.spec.versions | map(.name != "v1") | all)' artifacts/manifests.yaml > artifacts/experimental-manifests.yaml
373+
374+
362375
##@ Coverage
363376

364377
COVERAGE_DIR ?= coverage

0 commit comments

Comments
 (0)