mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-05-21 07:32:15 +00:00
Fixed changelog escaping
This commit is contained in:
parent
7cead79245
commit
1e484a02a3
45
.github/workflows/build-and-release.yml
vendored
45
.github/workflows/build-and-release.yml
vendored
@ -976,25 +976,36 @@ jobs:
|
|||||||
FORMATTED_BUILD_TIME: ${{ needs.read_metadata.outputs.formatted_build_time }}
|
FORMATTED_BUILD_TIME: ${{ needs.read_metadata.outputs.formatted_build_time }}
|
||||||
CHANGELOG: ${{ needs.read_metadata.outputs.changelog }}
|
CHANGELOG: ${{ needs.read_metadata.outputs.changelog }}
|
||||||
|
|
||||||
run: |
|
run: |
|
||||||
# Read the platforms JSON, which was created in the previous step:
|
# Read the platforms JSON, which was created in the previous step:
|
||||||
platforms=$(cat $GITHUB_WORKSPACE/.updates/platforms.json)
|
platforms=$(cat $GITHUB_WORKSPACE/.updates/platforms.json)
|
||||||
|
|
||||||
# Replace newlines in changelog with \n
|
# Create the latest.json file via jq so the changelog is escaped as valid JSON.
|
||||||
changelog=$(echo "$CHANGELOG" | awk '{printf "%s\\n", $0}')
|
jq -n \
|
||||||
|
--arg version "$FORMATTED_VERSION" \
|
||||||
# Escape double quotes in changelog:
|
--arg notes "$CHANGELOG" \
|
||||||
changelog=$(echo "$changelog" | sed 's/"/\\"/g')
|
--arg pub_date "$FORMATTED_BUILD_TIME" \
|
||||||
|
--argjson platforms "$platforms" \
|
||||||
# Create the latest.json file:
|
'{
|
||||||
cat <<EOOOF > $GITHUB_WORKSPACE/release/assets/latest.json
|
version: $version,
|
||||||
{
|
notes: $notes,
|
||||||
"version": "$FORMATTED_VERSION",
|
pub_date: $pub_date,
|
||||||
"notes": "$changelog",
|
platforms: $platforms
|
||||||
"pub_date": "$FORMATTED_BUILD_TIME",
|
}' > $GITHUB_WORKSPACE/release/assets/latest.json
|
||||||
"platforms": $platforms
|
|
||||||
}
|
- name: Validate latest.json
|
||||||
EOOOF
|
env:
|
||||||
|
CHANGELOG: ${{ needs.read_metadata.outputs.changelog }}
|
||||||
|
|
||||||
|
run: |
|
||||||
|
# Ensure the generated file is valid JSON and the changelog round-trips unchanged.
|
||||||
|
jq -e . $GITHUB_WORKSPACE/release/assets/latest.json > /dev/null
|
||||||
|
|
||||||
|
generated_notes=$(jq -r '.notes' $GITHUB_WORKSPACE/release/assets/latest.json)
|
||||||
|
if [[ "$generated_notes" != "$CHANGELOG" ]]; then
|
||||||
|
echo "The generated notes field does not match the changelog input."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Show all release assets
|
- name: Show all release assets
|
||||||
run: ls -Rlhat $GITHUB_WORKSPACE/release/assets
|
run: ls -Rlhat $GITHUB_WORKSPACE/release/assets
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user