3 # vim: expandtab sw=4 ts=4 sts=4:
5 # This requires Bash for the search and replace substitution to escape dots
8 if [ -n "$GATEWAY_INTERFACE" ] ; then
9 echo 'Can not invoke as CGI!'
13 # Fail on undefined variables
20 echo "Please pass the new version number as a command line argument such as"
21 echo "$0 -v 5.0.0-dev"
39 # If we're in the scripts directory, we need to do all our work up a directory level
40 if [ "$(basename "$
(pwd)")" = 'bin' ]
47 # There are half a dozen ways to do this, including individually recreating the line of
48 # each file (search for 'version =' in conf.py and replace it with 'version = 5.0.0-dev'
49 # for instance), and while that's more precise this should work with less to fix if a line changes.
50 # This method wasn't selected for any particular strength.
52 oldVersion
="$(grep 'version =' "${dir}"docs/conf.py | cut -d "'" -f2)"
54 echo "Changing from ${oldVersion} to ${newVersion}..."
56 # Escape the dot for sed
57 oldVersion=${oldVersion//./\.}
58 newVersion=${newVersion//./\.}
60 for f in README docs/conf.py package.json
62 if ! grep --quiet "${oldVersion}" "${dir}${f}"
64 # There may be a better way to test for a failure of the substitution itself, such as using the 'q
' directive with sed
65 # See https://stackoverflow.com/questions/15965073/return-code-of-sed-for-no-match
66 echo "FAILED! Substitution string ${oldVersion} not found in ${dir}${f}"
68 sed -i "s/${oldVersion}/${newVersion}/g" "${dir}${f}"
72 echo "- Next, you need to manually edit ChangeLog to manually change the version number and set the release date, and verify the changes with 'git
diff'."
73 echo "- You will probably want to call: \"./bin/console set-version ${newVersion}\" afterwards"
74 echo "- You should check if you need to change the composer.json file and the theme.json file for each bundled theme."
75 echo " To change the composer.json file you can call something like: \"composer config extra.branch-alias.dev-master \"5.2.x-dev\"\""
76 echo "- Suggested commit message: Prepare for version ${newVersion}"