[CI] different scheme for versioning #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish To PyPI | |
on: | |
push: | |
branches: ['main'] | |
jobs: | |
build-publish: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set environnment package version from commit | |
run: | | |
SHORT_SHA=$(echo ${{ github.sha }} | cut -c-12) | |
echo "PACKAGE_VERSION=0.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 | |
run: pip install build twine | |
- name: Build wheel | |
run: | | |
echo "Building version ${PACKAGE_VERSION}" | |
python -m build | |
- name: Publish distribution to PyPI | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} | |
run: twine upload --repository pypi dist/* | |