Skip to content

Commit e730588

Browse files
committed
Publish link schemas
Starting with v0.4.0 the spec includes links schemas which needs to be published along with the other jsonschemas. Fixes: #43 Signed-off-by: Andrea Frittoli <[email protected]>
1 parent 8fef4c5 commit e730588

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

.github/workflows/nightly-deploy.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ on:
33
workflow_dispatch: {}
44
jobs:
55
sync:
6-
name: 'Sync content and deploy'
6+
name: Sync content and deploy
77
runs-on: ubuntu-latest
88

99
defaults:
@@ -27,7 +27,7 @@ jobs:
2727
# Stage changes and check status
2828
GIT_STATUS=$(git status -s)
2929
if [ -n "$GIT_STATUS" ]; then PUSH_AND_SYNC='true' ; fi
30-
echo ::set-output name=PUSH_AND_SYNC::${PUSH_AND_SYNC}
30+
echo "PUSH_AND_SYNC=${PUSH_AND_SYNC}" >> $GITHUB_OUTPUT
3131
3232
- name: Create a commit and push if needed
3333
if: ${{ steps.update.outputs.PUSH_AND_SYNC }}

scripts/build-static.sh

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,27 @@ STATIC_DIR="${BASE_DIR}/static"
88
DOCS_DIR="$(mktemp -d)"
99

1010
# Clone the spec repo to pull the schemas
11-
git clone https://github.com/cdevents/spec ${DOCS_DIR}
11+
git clone https://github.com/cdevents/spec "${DOCS_DIR}"
1212

1313
# Serve versioned schemas
1414
cd "${DOCS_DIR}"
1515
for tag in $(git tag); do
1616
# Get the version by trimming the "v"
17-
version=$(printf $tag | sed 's/^v//g')
17+
version=$(printf '%s' "${tag}" | sed 's/^v//g')
1818
TARGET_SCHEMA_FOLDER="${STATIC_DIR}/${version}/schema"
1919
# Create the folder if it doesn't exists yet
20-
mkdir -p ${TARGET_SCHEMA_FOLDER} || true
20+
mkdir -p "${TARGET_SCHEMA_FOLDER}" || true
2121

2222
git checkout "${tag}"
23-
for schema in $(ls schemas/*json); do
23+
for schema in schemas/*json; do
2424
# Extract the schema name from the schema id itself
25-
TARGET_SCHEMA=$(awk -F'/' '/"\$id"/{ print $6 }' $schema | sed -e 's/",//g')
25+
TARGET_SCHEMA=$(awk -F'/' '/"\$id"/{ print $6 }' "${schema}" | sed -e 's/",//g')
2626
# Copy the file to static with the new name
27-
cp ${schema} ${TARGET_SCHEMA_FOLDER}/${TARGET_SCHEMA}
27+
cp "${schema}" "${TARGET_SCHEMA_FOLDER}/${TARGET_SCHEMA}"
2828
done
29+
30+
# Starting with v0.4 we serve links schemas too
31+
if [[ -d schemas/links ]]; then
32+
cp -r schemas/links "${TARGET_SCHEMA_FOLDER}"
33+
fi
2934
done

0 commit comments

Comments
 (0)