-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix grep and sed usage #1162
Merged
Merged
fix grep and sed usage #1162
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,15 +16,19 @@ | |
set -o errexit | ||
|
||
REPO="eth-cscs/DLA-Future" | ||
VERSION_MAJOR=$(sed -n 's/project(DLAF VERSION \([0-9]\+\)\.[0-9]\+\.[0-9]\+)/\1/p' CMakeLists.txt) | ||
VERSION_MINOR=$(sed -n 's/project(DLAF VERSION [0-9]\+\.\([0-9]\+\)\.[0-9]\+)/\1/p' CMakeLists.txt) | ||
VERSION_PATCH=$(sed -n 's/project(DLAF VERSION [0-9]\+\.[0-9]\+\.\([0-9]\+\))/\1/p' CMakeLists.txt) | ||
VERSION_MAJOR=$(sed -n 's/project(DLAF VERSION \([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\))/\1/p' CMakeLists.txt) | ||
VERSION_MINOR=$(sed -n 's/project(DLAF VERSION \([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\))/\2/p' CMakeLists.txt) | ||
VERSION_PATCH=$(sed -n 's/project(DLAF VERSION \([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\))/\3/p' CMakeLists.txt) | ||
VERSION_FULL="${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}" | ||
VERSION_FULL_TAG="v${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}" | ||
VERSION_TITLE="DLA-Future ${VERSION_FULL}" | ||
CURRENT_BRANCH="$(git rev-parse --abbrev-ref HEAD)" | ||
RELEASE_DATE=$(date '+%Y-%m-%d') | ||
|
||
GREP_VERSION_FULL="$(echo ${VERSION_FULL} | sed s/\\./\\\\./g)" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need to escape dots otherwise grep matches every char. |
||
GREP_VERSION_FULL_TAG="$(echo ${VERSION_FULL_TAG} | sed s/\\./\\\\./g)" | ||
GREP_VERSION_TITLE="$(echo ${VERSION_TITLE} | sed s/\\./\\\\./g)" | ||
|
||
if ! which gh >/dev/null 2>&1; then | ||
echo "GitHub CLI not installed on this system (see https://cli.github.com). Exiting." | ||
exit 1 | ||
|
@@ -50,6 +54,7 @@ fi | |
|
||
changelog_path="CHANGELOG.md" | ||
readme_path="README.md" | ||
documentation_path="DOCUMENTATION.md" | ||
cff_path="CITATION.cff" | ||
|
||
echo "You are about to tag and create a final release on GitHub." | ||
|
@@ -68,31 +73,55 @@ else | |
fi | ||
|
||
printf "Checking that %s has an entry for %s... " "${changelog_path}" "${VERSION_FULL}" | ||
if grep "## DLA-Future ${VERSION_FULL}" "${changelog_path}"; then | ||
if grep "## DLA-Future ${GREP_VERSION_FULL}" "${changelog_path}"; then | ||
echo "OK" | ||
else | ||
echo "Missing" | ||
sanity_errors=$((sanity_errors + 1)) | ||
fi | ||
|
||
printf "Checking that %s has a documentation entry for %s... " "${readme_path}" "master" | ||
if grep "^- \[Documentation of \`master\` branch\](https://eth-cscs.github.io/DLA-Future/master/)" "${readme_path}"; then | ||
echo "OK" | ||
else | ||
echo "Missing" | ||
sanity_errors=$((sanity_errors + 1)) | ||
fi | ||
|
||
printf "Checking that %s has a documentation entry for %s... " "${readme_path}" "${VERSION_FULL}" | ||
if grep "^- \[Documentation of \`${VERSION_FULL_TAG}\`\](https://eth-cscs.github.io/DLA-Future/${VERSION_FULL_TAG}" "${readme_path}"; then | ||
if grep "^- \[Documentation of \`${GREP_VERSION_FULL_TAG}\`\](https://eth-cscs.github.io/DLA-Future/${GREP_VERSION_FULL_TAG}/)" "${readme_path}"; then | ||
echo "OK" | ||
else | ||
echo "Missing" | ||
sanity_errors=$((sanity_errors + 1)) | ||
fi | ||
|
||
printf "Checking that %s has no extra documentation entries... " "${readme_path}" | ||
if [[ $(grep "^- \[Documentation of .*\](.*)" "${readme_path}" | wc -l) -eq 2 ]] ; then | ||
echo "OK" | ||
else | ||
echo "Failed" | ||
sanity_errors=$((sanity_errors + 1)) | ||
fi | ||
|
||
printf "Checking that %s has a documentation entry for %s... " "${documentation_path}" "${VERSION_FULL}" | ||
if grep "^- \[Documentation of \`${GREP_VERSION_FULL_TAG}\`\](https://eth-cscs.github.io/DLA-Future/${GREP_VERSION_FULL_TAG}" "${documentation_path}"; then | ||
echo "OK" | ||
else | ||
echo "Missing" | ||
sanity_errors=$((sanity_errors + 1)) | ||
fi | ||
|
||
printf "Checking that %s has correct version for %s... " "${cff_path}" "${VERSION_FULL}" | ||
if grep "^version: ${VERSION_FULL}" "${cff_path}"; then | ||
if grep "^version: ${GREP_VERSION_FULL}" "${cff_path}"; then | ||
echo "OK" | ||
else | ||
echo "Missing" | ||
sanity_errors=$((sanity_errors + 1)) | ||
fi | ||
|
||
printf "Checking that %s has correct title for %s... " "${cff_path}" "${VERSION_FULL}" | ||
if grep "^title: ${VERSION_TITLE}" "${cff_path}"; then | ||
if grep "^title: ${GREP_VERSION_TITLE}" "${cff_path}"; then | ||
echo "OK" | ||
else | ||
echo "Missing" | ||
|
@@ -149,7 +178,7 @@ else | |
fi | ||
|
||
remote=$(git remote -v | grep "github.com[:/]eth-cscs/DLA-Future.git" | cut -f1 | uniq) | ||
if [[ "$(git ls-remote --tags --refs $remote | grep -o ${VERSION_FULL_TAG})" == "${VERSION_FULL_TAG}" ]]; then | ||
if [[ "$(git ls-remote --tags --refs $remote | grep -o ${GREP_VERSION_FULL_TAG})" == "${VERSION_FULL_TAG}" ]]; then | ||
echo "Tag already exists remotely." | ||
else | ||
echo "Pushing tag to $remote." | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[0-9]\+
is not supported by sed on macos.(also
[0-9]\{1,\}
is only supported by GNU sed)