name: Release & Publish on: push: branches: [main] tags: - 'v*' jobs: build: runs-on: ubuntu-latest outputs: version: ${{ steps.version.outputs.version }} steps: - name: Checkout code uses: actions/checkout@v4 with: fetch-depth: 0 - name: Use system Python run: | echo "Python $(python3 --version)" echo "UV=$(uv --version)" echo "$HOME/.local/bin" >> $GITHUB_PATH - name: Get version from tag or pyproject id: version run: | if [[ $GITHUB_REF == refs/tags/v* ]]; then VERSION=${GITHUB_REF#refs/tags/v} else VERSION=$(uv run python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])") fi echo "version=$VERSION" >> $GITHUB_OUTPUT - name: Install dependencies run: uv sync --group dev - name: Run tests run: uv run pytest tests/unit/ -v - name: Build package run: uv build - name: Save dist path run: echo "DIST_PATH=$(pwd)/dist" >> $GITHUB_ENV publish-gitea: needs: build runs-on: ubuntu-latest if: startsWith(github.ref, 'refs/tags/v') steps: - name: Checkout code uses: actions/checkout@v4 - name: Get version from tag run: | VERSION=${GITHUB_REF#refs/tags/v} echo "VERSION=$VERSION" >> $GITHUB_ENV - name: Build package run: uv build - name: Publish to Gitea Packages run: | # Gitea PyPI-compatible API uv publish \ --username ${{ github.actor }} \ --password ${{ secrets.GITEA_TOKEN }} \ https://git.much-data.ru/api/packages/${{ github.repository_owner }}/pypi docs: needs: build runs-on: ubuntu-latest if: github.ref == 'refs/heads/main' steps: - name: Checkout code uses: actions/checkout@v4 - name: Use system Python run: | echo "Python $(python3 --version)" echo "$HOME/.local/bin" >> $GITHUB_PATH - name: Install dependencies run: uv sync --group dev - name: Build documentation run: uv run mkdocs build - name: Deploy to Gitea Pages uses: peaceiris/actions-gh-pages@v4 with: personal_token: ${{ secrets.GITEA_TOKEN }} publish_dir: ./site external_repository: ${{ github.repository_owner }}/${{ github.event.repository.name }}-docs publish_branch: gh-pages