From dd57708509e46287ebc9e8b82392185df440ebd1 Mon Sep 17 00:00:00 2001 From: MarcoReidelbach Date: Sun, 15 Sep 2024 19:16:57 +0200 Subject: [PATCH] Updated Workflow for pypi publication --- .github/workflows/pypi-publish.yml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml index ee0990d..135deed 100644 --- a/.github/workflows/pypi-publish.yml +++ b/.github/workflows/pypi-publish.yml @@ -2,30 +2,42 @@ name: Publish to PyPI on: release: - types: [published] + types: [published] # Trigger when a release is published jobs: deploy: runs-on: ubuntu-latest steps: + # Step 1: Check out the repository - name: Check out code uses: actions/checkout@v3 + # Step 2: Set up Python - name: Set up Python uses: actions/setup-python@v4 with: - python-version: '3.10' # Specify your desired Python version + python-version: '3.9' + # Step 3: Update version in __init__.py + - name: Update version in __init__.py + run: | + VERSION_TAG=${{ github.ref_name }} # Get the release tag (e.g., v1.0.0) + sed -i "s/__version__ = .*/__version__ = '${VERSION_TAG}'/" MaRDMO/__init__.py + shell: bash + + # Step 4: Install dependencies - name: Install dependencies run: | python -m pip install --upgrade pip pip install setuptools wheel twine + # Step 5: Build the distribution files - name: Build package run: | python setup.py sdist bdist_wheel + # Step 6: Publish to PyPI - name: Publish package to PyPI env: TWINE_USERNAME: __token__