From 716b41e91be1d75202e0b8157e1bbbacd9e80604 Mon Sep 17 00:00:00 2001
From: Chanwit Kaewkasi <chanwit@gmail.com>
Date: Fri, 19 Nov 2021 20:56:11 +0700
Subject: [PATCH] publish json schemas as a single URL

Signed-off-by: Chanwit Kaewkasi <chanwit@gmail.com>

This change publishes the auto-generated JSON schemas as a single URL,
so that it is consumable by a tool like VS Code.

The CRD generator creates 2 files, a tar.gz for Kubeval,
and another one is a JSON file. The JSON file is a combination of
all schemas, put under the "oneOf" operator.
---
 .github/workflows/release.yaml | 2 ++
 .goreleaser.yml                | 1 +
 2 files changed, 3 insertions(+)

diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
index e00167d0..cdba2f74 100644
--- a/.github/workflows/release.yaml
+++ b/.github/workflows/release.yaml
@@ -61,8 +61,10 @@ jobs:
         with:
           crd: all-crds.yaml
           output: schemas
+          combined_filename: crd-schemas.json
       - name: Archive the OpenAPI JSON schemas
         run: |
+          mv schemas/crd-schemas.json ./output/crd-schemas.json
           tar -czvf ./output/crd-schemas.tar.gz -C schemas .
       - name: Run GoReleaser
         uses: goreleaser/goreleaser-action@v1
diff --git a/.goreleaser.yml b/.goreleaser.yml
index b57017b1..480c3ba2 100644
--- a/.goreleaser.yml
+++ b/.goreleaser.yml
@@ -83,6 +83,7 @@ release:
     - glob: ./output/crd-schemas.tar.gz
     - glob: ./output/manifests.tar.gz
     - glob: ./output/install.yaml
+    - glob: ./output/crd-schemas.json
 dockers:
 - image_templates:
     - 'fluxcd/flux-cli:{{ .Tag }}-amd64'
-- 
GitLab