Skip to content
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

Do not update NEWS file version if development version is set #196

Merged
merged 1 commit into from
Nov 14, 2023
Merged
Changes from all 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
15 changes: 10 additions & 5 deletions .github/workflows/version-bump.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,21 @@ jobs:
then {
git config --global --add safe.directory $(pwd)
DESC_VERSION=$(R --slave -e 'cat(paste(desc::desc_get_version()))')
NEWS_VERSION=$(awk '/^#+ /{print $3; exit}' NEWS.md)
NEWS_VERSION=$(awk '/^#+ /{print $3,$4; exit}' NEWS.md)
FIRST_NEWS_LINE=$(head -1 NEWS.md)
if [ "${{ inputs.vbump-after-release }}" == "true" ]; then
# Add a new section with the released version that will be vbumped below.
printf "$FIRST_NEWS_LINE\n\n" | cat - NEWS.md > temp-news.md
mv temp-news.md NEWS.md
fi
# Replace only the first occurence of $NEWS_VERSION.
sed -i "0,/$NEWS_VERSION/s/$NEWS_VERSION/$DESC_VERSION/" NEWS.md
NEWS_VERSION=$(awk '/^#+ /{print $3; exit}' NEWS.md)
# Replace only the first occurence of $NEWS_VERSION,
# but only if it's not already set to (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!"
Expand Down Expand Up @@ -133,7 +138,7 @@ jobs:
- name: Set file pattern to commit ⚙️
id: file-pattern
run: |
if [[ "${{ inputs.package-subdirectory }}" == "." ]]; then
if [[ "${{ inputs.package-subdirectory }}" == "." || "${{ inputs.package-subdirectory }}" == "" ]]; then
FILE_PATTERN="NEWS.md DESCRIPTION"
else
FILE_PATTERN="${{ inputs.package-subdirectory }}/NEWS.md ${{ inputs.package-subdirectory }}/DESCRIPTION"
Expand Down
Loading