Skip to content

Commit

Permalink
[CI] different scheme for versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
glpatcern committed Aug 27, 2024
1 parent d6e40ae commit 9903026
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Publish To PyPI
on:
push:
branches: ['main']

jobs:
build-publish:
runs-on: ubuntu-latest
Expand All @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit 9903026

Please sign in to comment.