Skip to content
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions createReleaseTarball.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,13 @@ echo "[INFO] Updating version number in package.json to ${VERSION_WITHOUT_RC}...
sed -i '' -e s/"\"version\": \".*\""/"\"version\": \"${VERSION_WITHOUT_RC}\""/ package.json
echo

#########################
# UPDATE CHANGELOG.md #
#########################
echo "[INFO] Updating version number in CHANGELOG.md to ${VERSION_WITHOUT_RC}..."
sed -i '' -e s/"# Unreleased"/"# v${VERSION_WITHOUT_RC}"/ CHANGELOG.md
Copy link
Contributor

@avishalom avishalom Jan 23, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems a bit fragile, What if "# Unreleased" appears anywhere else.
Also, it seems that the current version doesn't have a blank line in line number 2 .
What if it was deleted in the process.

I suggest,

  • only sed-ing the first line,
  • replace "# Unreleased" or ignore it and append if it isn't there
  • append to the end of the first line so that anything non congruent stands out
    s.t. like

sed -i '' -E '1 s/(# Unreleased|^)/# Unreleased'$'\\n\\n-\\n'"# v${VERSION_WITHOUT_RC}/" CHANGELOG.md

instead of lines 95-97

Copy link
Contributor Author

@hiranya911 hiranya911 Jan 23, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the sed command to only replace the first occurrence. Points 2 and 3 are hard to implement in a way that is compatible with both Linux and Mac. So I'm keeping the simple cat to file, and move solution for now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My only worry is that if someone accidentally changes that first line, the version will not be added.
How about replacing the first "# Unreleased" with nothing ("") and adding the v$VERSION_WITHOUT_RC in the echo in the next line ?

echo -e "# Unrelased\n\n-\n" | cat - CHANGELOG.md > TEMP_CHANGELOG.md
mv TEMP_CHANGELOG.md CHANGELOG.md

############################
# REINSTALL DEPENDENCIES #
Expand Down