Skip to content

Commit

Permalink
add release and date consistency check
Browse files Browse the repository at this point in the history
Adds a Github Actions check for the release number and date in the
changelog and citation files.
  • Loading branch information
BlinkDynamo authored Jun 14, 2024
1 parent 3b6d81d commit ed85c54
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
36 changes: 35 additions & 1 deletion .github/workflows/analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,38 @@ jobs:
else
exit 0
fi
release-version-and-date-analysis:
name: "release version and date analysis"
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
with:
fetch-depth: 0
- name: Release Version and Date Analysis
run: |
# search for release and date line from CITATION.cff with format:
# 'version: X.X.X' and 'date-released: XXXX-XX-XX' then extract to variables
# find the line with each, then extract the value wanted (version number or date) as well as line number
version_citation_info=$(grep -n -E -m1 '^version: [0-9]+\.[0-9]+\.[0-9]+' "CITATION.cff")
version_citation_line=$(echo "$version_citation_info" | cut -d: -f1)
version_citation=$(echo "$version_citation_info" | awk '{print $2}')
date_citation_info=$(grep -n -E -m1 'date-released: [0-9]{4}-[0-9]{2}-[0-9]{2}' "CITATION.cff")
date_citation_line=$(echo "$date_citation_info" | cut -d: -f1)
date_citation=$(echo "$date_citation_info" | awk '{print $2}')
# search for version and date line from ChangeLog.md with format:
# '## [X.X.X] - [XX-XX-XXXX]'
# find most recent line with version and date of release in ChangeLog.md
vd_changelog_info=$(grep -n -E -m1 '## \[[0-9]+\.[0-9]+\.[0-9]+\] - [0-9]{4}-[0-9]{2}-[0-9]{2}' "ChangeLog.md")
vd_changelog_line=$(echo "$vd_changelog_info" | cut -d: -f1)
# extract version, date and line number (since it's always on one line) to variables
version_changelog=$(echo "$vd_changelog_info" | awk -F'[][]' '{print $2}')
date_changelog=$(echo "$vd_changelog_info" | awk -F' - ' '{print $2}')
# compare version numbers and dates between files, listing discrepancies where found
if [[ "$version_changelog" != "$version_citation" ]]; then
echo "Release version numbers do not match: $version_changelog (ChangeLog.md on line $vd_changelog_line) vs $version_citation (CITATION.cff on line $version_citation_line)"
exit 1
fi
if [[ "$date_changelog" != "$date_citation" ]]; then
echo "Release dates do not match: $date_changelog (ChangeLog.md on line $vd_changelog_line) vs $date_citation (CITATION.cff on line $date_citation_line)"
exit 1
fi
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Stumpless Logging Library
license: Apache-2.0
repository-code: "https://github.com/goatshriek/stumpless"
version: 2.2.0
date-released: 2023-01-16
date-released: 2024-05-26
keywords:
- journald
- logging
Expand Down

0 comments on commit ed85c54

Please sign in to comment.