Skip to content

Commit

Permalink
Handle bash-related nuances
Browse files Browse the repository at this point in the history
  • Loading branch information
cicdguy committed Nov 15, 2023
1 parent 80a7d4c commit 9249bc3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
9 changes: 1 addition & 8 deletions .github/workflows/version-bump.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,18 +87,11 @@ jobs:
fi
# Replace only the first occurence of $NEWS_VERSION,
# but only if it's not already set to (development version)
if [ "$NEWS_VERSION" != "(development version)" ]
if [ "${NEWS_VERSION}" != "(development version)" ]
then {
sed -i "0,/$NEWS_VERSION/s/$NEWS_VERSION/$DESC_VERSION/" NEWS.md
}
fi
NEWS_VERSION=$(awk '/^#+ /{print $3,$4; exit}' NEWS.md)
echo "Updated NEWS.md version: $NEWS_VERSION"
if (test $DESC_VERSION != $NEWS_VERSION ); then
echo "🙈 Updated NEWS.md and DESCRIPTION have different versions!"
echo "Please ensure that the versions in the NEWS.md and DESCRIPTION are the same 🙏"
exit 1
fi
echo "NEW_PKG_VERSION=${DESC_VERSION}" >> $GITHUB_ENV
}
fi
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/version.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ jobs:
DESC_DEV_VERSION=$(echo $DESC_VERSION | awk -F '.' '{print $NF}')
echo "NEWS.md version: $NEWS_VERSION"
echo "DESCRIPTION version: $DESC_VERSION"
if [[ "$DESC_VERSION" == "$NEWS_VERSION" ]]
if [[ "${DESC_VERSION}" == "${NEWS_VERSION}" ]]
then {
echo "NEWS.md and DESCRIPTION have the same version 🎉"
exit 0
}
fi
if [[ $DESC_DEV_VERSION -ge 9000 && "$NEWS_VERSION" == "(development version)" ]]
if [[ $DESC_DEV_VERSION -ge 9000 && "${NEWS_VERSION}" == "(development version)" ]]
then {
echo "NEWS.md and DESCRIPTION file versions are okay as package is in development mode."
echo "All is okay 🆗"
Expand Down

0 comments on commit 9249bc3

Please sign in to comment.