Skip to content

Commit

Permalink
init commit for citation.
Browse files Browse the repository at this point in the history
  • Loading branch information
RubelMozumder committed Sep 24, 2024
1 parent 5f1cd37 commit 084167a
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 0 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/check_citation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Version Check

on:
push:
branches:
- 'main'
pull_request:
branches:
- 'main'

jobs:
check-version:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .[dev]
# Check if the CITATION.cff file is valid
- name: Validate CITATION.cff
run: |
cffconvert --validate
- name: Package version
id: package_version
run: |
PACKAGE_VERSION=$(python -c "import pynxtools; print(pynxtools.__version__)")
echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV
echo "Version from __init__.py: $PACKAGE_VERSION"
- name: Citation version
id: citation_version
run: |
# Parse the version from the CITATION.cff file)
CITATION_VERSION=$(grep '^version:' CITATION.cff | cut -d' ' -f2)
echo "CITATION_VERSION=$CITATION_VERSION" >> $GITHUB_ENV
echo "Version from CITATION.cff: $CITATION_VERSION"
- name: Compare versions
run: |
if [ "$PACKAGE_VERSION" != "$CITATION_VERSION" ]; then
echo "Version mismatch: package version is $PACKAGE_VERSION, CITATION.cff version is $CITATION_VERSION"
exit 1
fi
echo "All versions match: $GIT_TAG_VERSION"
20 changes: 20 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,26 @@ jobs:
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
uv pip install build
- name: Git tag version
id: git_tag_version
run: |
# Extract the version from the tag (e.g., 'v1.0.0' becomes '1.0.0')
GIT_TAG_VERSION=${GITHUB_REF#refs/tags/v}
echo "GIT_TAG_VERSION=$GIT_TAG_VERSION" >> $GITHUB_ENV
echo "Version from Git tag: $GIT_TAG_VERSION"
- name: Citation version
id: citation_version
run: |
# Parse the version from the CITATION.cff file
CITATION_VERSION=$(grep '^version:' CITATION.cff | cut -d' ' -f2)
echo "CITATION_VERSION=$CITATION_VERSION" >> $GITHUB_ENV
echo "Version from CITATION.cff: $CITATION_VERSION"
- name: Compare versions
run: |
if [ "$GIT_TAG_VERSION" != "$CITATION_VERSION" ]; then
echo "Version mismatch: Git tag version is $GIT_TAG_VERSION, CITATION.cff version is $CITATION_VERSION"
exit 1
fi
- name: Build package
run: |
git reset --hard HEAD
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ dependencies = [
"importlib-metadata",
"lxml>=4.9.1",
"anytree",
"cffconvert",
]

[project.urls]
Expand Down
1 change: 1 addition & 0 deletions src/pynxtools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from pynxtools.definitions.dev_tools.globals.nxdl import get_nxdl_version

LOGGER_LEVELS_TO_HIGHLIGHT = (logging.WARNING, logging.ERROR)
__version__ = "0.7.2"


class CustomFormatter(logging.Formatter):
Expand Down

0 comments on commit 084167a

Please sign in to comment.