Skip to content

Commit 819b51e

Browse files
authored
Merge pull request #27 from codeboxrcodehub/dev
workflow fixed
2 parents 2d489b8 + 7a503bc commit 819b51e

File tree

1 file changed

+27
-20
lines changed

1 file changed

+27
-20
lines changed

.github/workflows/deploy.yml

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -37,33 +37,40 @@ jobs:
3737
run: |
3838
changelog_section_start="== Changelog =="
3939
readme_file="$readme_file"
40-
plugin_version="${{ github.ref_name }}" # Assuming the tag is the version
41-
40+
plugin_version="master" # Assuming the tag is the version
41+
4242
in_changelog=0
4343
release_notes=""
44+
4445
while IFS= read -r line; do
45-
if [[ "$line" == "$changelog_section_start" ]]; then
46-
in_changelog=1
47-
continue
48-
fi
49-
50-
if [[ $in_changelog -eq 1 && "$line" =~ ^== ]]; then
51-
break
52-
fi
53-
54-
if [[ $in_changelog -eq 1 && -n "$line" ]]; then
55-
release_notes+="$line\n"
56-
fi
46+
if [[ "$line" == "$changelog_section_start" ]]; then
47+
in_changelog=1
48+
continue
49+
fi
50+
51+
# Stop capturing when another section starts
52+
if [[ $in_changelog -eq 1 && "$line" =~ ^== ]]; then
53+
break
54+
fi
55+
56+
# Capture non-empty lines within the changelog section
57+
if [[ $in_changelog -eq 1 && -n "$line" ]]; then
58+
release_notes+="$line\n"
59+
fi
5760
done < "$readme_file"
58-
61+
62+
# Ensure release notes were extracted
5963
if [[ -z "$release_notes" ]]; then
60-
echo "::error::Failed to extract release notes from the changelog section."
61-
exit 1
64+
echo "::error::Failed to extract release notes from the changelog section."
65+
exit 1
6266
fi
63-
64-
# Escape special characters and set the RELEASE_NOTES environment variable correctly
65-
release_notes_escaped=$(echo "$release_notes" | awk '{printf "%s\\n", $0}')
67+
68+
# Escape special characters for environment variable
69+
release_notes_escaped=$(printf "%s" "$release_notes" | sed 's/%/%25/g; s/\n/%0A/g; s/\r/%0D/g')
70+
71+
# Set the RELEASE_NOTES environment variable
6672
echo "RELEASE_NOTES=$release_notes_escaped" >> $GITHUB_ENV
73+
6774
source $GITHUB_ENV # Ensure the environment variable is available for subsequent steps
6875
6976
- name: Create zip file

0 commit comments

Comments
 (0)