diff --git a/.githooks/pre-commit b/.githooks/pre-commit index d6371c9..d48ef0e 100755 --- a/.githooks/pre-commit +++ b/.githooks/pre-commit @@ -3,21 +3,25 @@ # Check if pyproject.toml is being modified if git diff --cached --name-only | grep -q "pyproject.toml"; then - # Extract the version from pyproject.toml - VERSION=$(grep -E 'version\s*=\s*"[^"]+"' pyproject.toml | head -1 | sed -E 's/.*version\s*=\s*"([^"]+)".*/\1/') - + # Extract the version from pyproject.toml. + # Use [[:space:]] instead of \s so the regex works on both GNU and BSD + # (macOS) grep/sed — BSD treats \s as a literal 's', which silently + # falls back to capturing the whole line and corrupts CITATION.cff. + VERSION=$(grep -E '^[[:space:]]*version[[:space:]]*=[[:space:]]*"[^"]+"' pyproject.toml | head -1 | sed -E 's/.*version[[:space:]]*=[[:space:]]*"([^"]+)".*/\1/') + if [ -n "$VERSION" ]; then # Get current date in YYYY-MM-DD format TODAY=$(date +"%Y-%m-%d") - - # Update version and date in CITATION.cff - sed -i.bak -E "s/version: .*/version: $VERSION/" CITATION.cff - sed -i.bak -E "s/date-released: .*/date-released: '$TODAY'/" CITATION.cff + + # Update version and date in CITATION.cff. Anchor with ^ so the + # `version:` rule does not also clobber the `cff-version:` line. + sed -i.bak -E "s/^version: .*/version: $VERSION/" CITATION.cff + sed -i.bak -E "s/^date-released: .*/date-released: '$TODAY'/" CITATION.cff rm CITATION.cff.bak - + # Add the updated CITATION.cff to the commit git add CITATION.cff - + echo "Updated CITATION.cff to version $VERSION and date $TODAY" fi fi diff --git a/CITATION.cff b/CITATION.cff index babe0cb..6a48c29 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -17,5 +17,5 @@ keywords: - functional annotation - consensus gene models license: BSD-2-Clause -version: 26.5.22 -date-released: '2026-05-24' +version: 2026.6.9 +date-released: '2026-06-09' diff --git a/pyproject.toml b/pyproject.toml index 1a16fa4..84aada9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "funannotate2" -version = "26.5.22" +version = "2026.6.9" description = "Funannotate2: eukarytoic genome annotation pipeline" readme = {file = "README.md", content-type = "text/markdown"} authors = [