Add a description in pyproject.toml for pypi #13
This file contains hidden or 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: Build and Publish | |
| on: | |
| push: | |
| branches: | |
| - main | |
| env: | |
| MAJOR: 0 | |
| MINOR: 1 | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout (with full history for versioning) | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Compute patch version | |
| id: version | |
| run: | | |
| LAST_TAG=$(git tag --list "v${MAJOR}.${MINOR}.*" --sort=-v:refname | head -n 1) | |
| if [ -z "$LAST_TAG" ]; then | |
| PATCH=0 | |
| else | |
| PATCH=$(($(echo "$LAST_TAG" | awk -F. '{print $3}' | sed 's/^v//') + 1)) | |
| fi | |
| VERSION="v${MAJOR}.${MINOR}.${PATCH}" | |
| echo "version=${VERSION}" >> $GITHUB_OUTPUT | |
| echo "Computed version: $VERSION" | |
| - name: Set up Python 3.12 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install uv | |
| run: pipx install uv | |
| - name: Install dependencies | |
| run: uv sync | |
| - name: Run tests | |
| run: uv run pytest . | |
| - name: Update version in pyproject.toml | |
| run: | | |
| sed -i -E "s/^(version = \").*\"/\1${{ steps.version.outputs.version }}\"/" pyproject.toml | |
| - name: Build package | |
| run: uv build | |
| - name: Publish to Azure Artifact using uv | |
| env: | |
| UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }} | |
| run: uv publish | |
| - name: Create version tag | |
| run: | | |
| git tag ${{ steps.version.outputs.version }} | |
| git push origin ${{ steps.version.outputs.version }} |