Skip to content

Commit

Permalink
Update tools with new files and folders
Browse files Browse the repository at this point in the history
Signed-off-by: Andrea Frittoli <[email protected]>
  • Loading branch information
afrittoli committed May 16, 2024
1 parent fe2ec0e commit e653c32
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions tools/event-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ SPLIT_EVENT=(${EVENT_SUBJECT_PREDICATE//./ })
SUBJECT=${SPLIT_EVENT[0]}
PREDICATE=${SPLIT_EVENT[1]}
SCHEMA_FILE="schemas/${SUBJECT}${PREDICATE}.json"
EXAMPLE_FILE="examples/${SUBJECT}_${PREDICATE}.json"
EXAMPLE_FILE="conformance/${SUBJECT}_${PREDICATE}.json"

# Evaluate the event version
OLD_VERSION=$(sed -n -e '/"default": "dev.cdevents.'${SUBJECT}'.'${PREDICATE}'./s/.*\.\([0-9]\.[0-9]\.[0-9]\(-draft\)\{0,1\}\)"/\1/p' ${SCHEMA_FILE})
Expand All @@ -145,7 +145,7 @@ fi
if [[ "${COMMAND}" == "${START_COMMAND}" ]]; then
if [[ -n ${DRAFT_VERSION} ]]; then
echo "Cannot start release ${VERSION}, already in ${DRAFT_VERSION}"
# Still ensure examples are up to date with OLD_VERSION
# Still ensure conformance files are up to date with OLD_VERSION
VERSION=${OLD_VERSION}
replace_example
# Cleanup backup files
Expand Down
9 changes: 6 additions & 3 deletions tools/spec-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -147,17 +147,20 @@ VERSION="${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}${DRAFT_VERSION}"
find schemas -name '*json' | \
xargs sed -i ".backup" -e 's,https://cdevents.dev/'${OLD_VERSION}'/schema/,https://cdevents.dev/'${VERSION}'/schema/,g'

# Replace the version in the examples
find examples -name '*json' | \
# Replace the version in the conformance files
find conformance -name '*json' | \
xargs sed -i ".backup" -e 's,"version": "'${OLD_VERSION}'","version": "'${VERSION}'",g'

# Replace the version in the custom events schema ID
find custom -name '*json' | \
xargs sed -i ".backup" -e 's,https://cdevents.dev/'${OLD_VERSION}'/schema/,https://cdevents.dev/'${VERSION}'/schema/,g'

# Replace the version in the custom events conformance file
find custom -name '*json' | \
xargs sed -i ".backup" -e 's,"version": "'${OLD_VERSION}'","version": "'${VERSION}'",g'

# Update examples in docs
for doc in cloudevents-binding spec; do
for doc in cloudevents-binding spec links; do
sed -i ".backup" -e 's;"version": "'${OLD_VERSION}'",;"version": "'${VERSION}'",;g' "${doc}.md"
done

Expand Down

0 comments on commit e653c32

Please sign in to comment.