From 671d30250db4c6349b02574dcbed7fea63125e1e Mon Sep 17 00:00:00 2001 From: borisbolliet Date: Sun, 15 Dec 2024 10:21:31 +0100 Subject: [PATCH] setup workflow file and adjusting version number --- .github/workflows/python-package.yml | 38 ++++++++++++ .github/workflows/python-publish.yml | 87 ---------------------------- cmbagent/version.py | 17 +----- pyproject.toml | 8 +-- 4 files changed, 43 insertions(+), 107 deletions(-) create mode 100644 .github/workflows/python-package.yml delete mode 100644 .github/workflows/python-publish.yml diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml new file mode 100644 index 0000000..712c27a --- /dev/null +++ b/.github/workflows/python-package.yml @@ -0,0 +1,38 @@ +name: python-package + +on: + # push: + # branches: + # - main + workflow_dispatch: + release: + types: [published] + +permissions: # Ensure the workflow has permission to push changes + # contents: write # Allow write access for pushing to the repository + +jobs: + deploy: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: '3.x' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install build + + - name: Build package + run: python -m build + + - name: Publish package + uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml deleted file mode 100644 index 6e8bc95..0000000 --- a/.github/workflows/python-publish.yml +++ /dev/null @@ -1,87 +0,0 @@ -name: Upload Python Package to PyPi - -on: - # push: - # branches: - # - main - workflow_dispatch: - release: - types: [published] - -permissions: # Ensure the workflow has permission to push changes - contents: write # Allow write access for pushing to the repository - -jobs: - bump_version: - runs-on: ubuntu-latest - steps: - - name: Checkout the code - uses: actions/checkout@v4 - with: - persist-credentials: true - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: "3.x" - - - name: Bump beta version - run: | - VERSION_FILE="cmbagent/version.py" - current_version=$(grep -Eo '__version__ = "[^"]*' "$VERSION_FILE" | cut -d'"' -f2) - - if [[ $current_version =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)\.beta([0-9]+)$ ]]; then - major="${BASH_REMATCH[1]}" - minor="${BASH_REMATCH[2]}" - patch="${BASH_REMATCH[3]}" - beta="${BASH_REMATCH[4]}" - - # Increment the beta version - new_beta=$((beta + 1)) - new_version="${major}.${minor}.${patch}.beta${new_beta}" - - # Update the version in version.py - sed -i "s/__version__ = \"$current_version\"/__version__ = \"$new_version\"/" "$VERSION_FILE" - echo "Version bumped to: $new_version" - else - echo "Current version format is not valid for beta versioning." - exit 1 - fi - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Commit and push version bump - run: | - git config --global user.name "GitHub Actions" - git config --global user.email "actions@github.com" - git add cmbagent/version.py - git commit -m "Bump beta version to $new_version" - git push - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - deploy: - needs: bump_version - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v3 - with: - python-version: '3.x' - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install build - - - name: Build package - run: python -m build - - - name: Publish package - uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 - with: - user: __token__ - password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/cmbagent/version.py b/cmbagent/version.py index 3375b70..7f3e672 100644 --- a/cmbagent/version.py +++ b/cmbagent/version.py @@ -1,16 +1 @@ -# file generated by setuptools_scm -# don't change, don't track in version control -TYPE_CHECKING = False -if TYPE_CHECKING: - from typing import Tuple, Union - VERSION_TUPLE = Tuple[Union[int, str], ...] -else: - VERSION_TUPLE = object - -version: str -__version__: str -__version_tuple__: VERSION_TUPLE -version_tuple: VERSION_TUPLE - -__version__ = version = '0.1.dev199+g712bb53.d20241214' -__version_tuple__ = version_tuple = (0, 1, 'dev199', 'g712bb53.d20241214') +__version__ = "0.0.1post1" \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index e2c00f2..cb06e4a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ requires = [ build-backend = "setuptools.build_meta" [project] -version = "0.0.0" # Will be overwritten by setuptools-scm +version = "0.0.1post1" name = "cmbagent" maintainers = [{name = "CMBAgents Team", email = "cmbagents@gmail.com"}] description = "Multi-agent system for data analysis, made by cosmologists, powered by autogen." @@ -20,7 +20,7 @@ dependencies = [ "cobaya", "getdist", "classy_sz", - "pyautogen_cmbagent>=0.5.3", + "cmbagent_autogen>=0.0.6post1", "ruamel.yaml", "pandas", "ipython" @@ -40,8 +40,8 @@ cmbagent = [ Homepage = "https://github.com/CMBAgents/cmbagent" GitHub = "https://github.com/CMBAgents/cmbagent" -[tool.setuptools_scm] -write_to = "cmbagent/version.py" +#[tool.setuptools_scm] +#write_to = "cmbagent/version.py"