Skip to content

Commit

Permalink
ci: replace yml2json with yq v3
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean Krail committed Mar 27, 2020
1 parent 68d8653 commit 0e90f64
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ jobs:
- name: Checkout
uses: actions/checkout@v1

- name: Install yq via snap
run: |
snap install yq
yq --version
- name: Bundle all of the charts
run: |
./bundle.sh
Expand Down
23 changes: 9 additions & 14 deletions bundle.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
#!/bin/bash
set -eo pipefail

echo "Bundling all of the charts..."

# Convert the definitions YAML-based JSON schema into JSON
yml2json definitions.schema.yaml --output definitions.schema.json
echo -n "Bundling all of the charts..."

# Loop through every chart
for chart in charts/*; do
# Convert the values YAML-based JSON schema into JSON
yml2json "${chart}"/values.schema.yaml --output "${chart}"/values-temp.schema.json

# Combine the values.schema.json and definitions.schema.json files
# with the values.schema.json file taking precedence recursively
# See https://stedolan.github.io/jq/manual/#Multiplication,division,modulo:*,/,and%
jq --compact-output --slurp '.[0] * .[1]' definitions.schema.json "${chart}"/values-temp.schema.json > "${chart}"/values.schema.json

# Remove the temporary JSON schema file
rm "${chart}"/values-temp.schema.json
# Combine the definitions.schema.yaml and charts/$chart/values.schema.yaml files
# with the charts/$chart/values.schema.yaml file taking precedence
# and output the merged YAML document as JSON.
# See https://mikefarah.gitbook.io/yq/commands/merge
# and https://mikefarah.gitbook.io/yq/usage/convert
yq merge --overwrite --tojson definitions.schema.yaml "${chart}"/values.schema.yaml > "${chart}"/values.schema.json
done

echo "done"

0 comments on commit 0e90f64

Please sign in to comment.