Skip to content

Commit

Permalink
Merge pull request #633 from jrl-umi3218/changelog
Browse files Browse the repository at this point in the history
release: update CHANGELOG.md
  • Loading branch information
nim65s authored Nov 14, 2023
2 parents 70ff030 + d769b7c commit 5709150
Showing 1 changed file with 36 additions and 9 deletions.
45 changes: 36 additions & 9 deletions release.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
macro(RELEASE_SETUP)
if(UNIX)
find_program(GIT git)
string(TIMESTAMP TODAY "%Y-%m-%d")

# Set LD_LIBRARY_PATH
if(APPLE)
Expand All @@ -60,20 +61,20 @@ macro(RELEASE_SETUP)
add_custom_target(
release_package_xml
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMENT "Update package.xml"
COMMAND
echo "Updating package.xml to $$VERSION" && sed -i.back
\"s|<version>.*</version>|<version>$$VERSION</version>|g\" package.xml
&& rm package.xml.back && ${GIT} add package.xml && ${GIT} commit -m
"release: Update package.xml version to $$VERSION" && echo
sed -i.back \"s|<version>.*</version>|<version>$$VERSION</version>|g\"
package.xml && rm package.xml.back && ${GIT} add package.xml && ${GIT}
commit -m "release: Update package.xml version to $$VERSION" && echo
"Updated package.xml and committed")

add_custom_target(
release_pyproject_toml
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMENT "Update pyproject.toml"
COMMAND
echo "Updating pyproject.toml to $$VERSION" && ${PYTHON_EXECUTABLE}
${PROJECT_JRL_CMAKE_MODULE_DIR}/pyproject.py $$VERSION && if !
(git diff --quiet pyproject.toml) ; then
${PYTHON_EXECUTABLE} ${PROJECT_JRL_CMAKE_MODULE_DIR}/pyproject.py
$$VERSION && if ! (git diff --quiet pyproject.toml) ; then
(${GIT}
add
pyproject.toml
Expand All @@ -86,9 +87,32 @@ macro(RELEASE_SETUP)
echo
"Updated pyproject.toml and committed") ; fi)

add_custom_target(
release_changelog
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMENT "Update CHANGELOG.md"
COMMAND
sed -i.back
"\"s|\#\# \\[Unreleased\\]|\#\# [Unreleased]\\n\\n\#\# [$$VERSION] - ${TODAY}|\""
CHANGELOG.md && sed -i.back
"\"s|^\\[Unreleased]: \\(https://.*compare/\\)\\(v.*\\)...HEAD|[Unreleased]: \\1v$$VERSION...HEAD\\n[$$VERSION]: \\1\\2...v$$VERSION|\""
CHANGELOG.md && if ! (git diff --quiet CHANGELOG.md) ; then
(${GIT}
add
CHANGELOG.md
&&
${GIT}
commit
-m
"release: Update CHANGELOG.md for $$VERSION"
&&
echo
"Updated CHANGELOG.md and committed") ; fi)

add_custom_target(
release
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMENT "Create a new release"
COMMAND
export LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH} && export
${LD_LIBRARY_PATH_VARIABLE_NAME}=$ENV{${LD_LIBRARY_PATH_VARIABLE_NAME}}
Expand All @@ -100,8 +124,11 @@ macro(RELEASE_SETUP)
release_package_xml) ; fi
# Update version in pyproject.toml if it exists
&& if [ -f "pyproject.toml" ]; then (make -C ${CMAKE_BINARY_DIR}
release_pyproject_toml) ; fi &&
${GIT} tag -s v$$VERSION -m "Release of version $$VERSION." && cd
release_pyproject_toml) ; fi
# Update CHANGELOG.md if it exists
&& if [ -f "CHANGELOG.md" ]; then (make -C ${CMAKE_BINARY_DIR}
release_changelog) ; fi && ${GIT}
tag -s v$$VERSION -m "Release of version $$VERSION." && cd
${CMAKE_BINARY_DIR} && cmake ${PROJECT_SOURCE_DIR} && make distcheck ||
(echo
"Please fix distcheck first."
Expand Down

0 comments on commit 5709150

Please sign in to comment.