diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 62fff1c..d4bb392 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -3,7 +3,7 @@ name: Publish To PyPI on: push: branches: ['main'] - + jobs: build-publish: runs-on: ubuntu-latest @@ -12,18 +12,22 @@ jobs: - uses: actions/checkout@v2 - name: Set environnment package version from commit - run: echo "PACKAGE_VERSION=v0.0.0-$(date +%Y%m%d)-${{ github.sha }}" >> $GITHUB_ENV # use same convention as Go bindings - + run: | + SHORT_SHA=$(echo ${{ github.sha }} | cut -c-12) + echo "PACKAGE_VERSION=v0.2.$(date +%Y%m%d).${SHORT_SHA}" >> $GITHUB_ENV # use same convention as Go bindings + - name: Set up Python 3.12 uses: actions/setup-python@v3 with: python-version: "3.12" - - name: Install dependencies + - name: Install dependencies run: pip install build twine - name: Build wheel - run: python -m build + run: | + echo "Building version ${PACKAGE_VERSION}" + python -m build - name: Publish distribution to PyPI env: diff --git a/setup.py b/setup.py index afcd7f4..045d33a 100644 --- a/setup.py +++ b/setup.py @@ -1,10 +1,14 @@ import setuptools +import os with open("README.md", "r") as fh: long_description = fh.read() +version = os.getenv("PACKAGE_VERSION", "v0.0.0") + setuptools.setup( name="cs3apis", + version=version, setup_requires=['setuptools_scm'], author="CS3 Organization", author_email="contact@cs3community.org",