kwork-api/.gitea/workflows/release.yml
root 309aca6036
Some checks failed
Release & Publish / build (push) Failing after 7s
Release & Publish / publish-gitea (push) Has been skipped
Release & Publish / docs (push) Has been skipped
ci: use system Python instead of setup-python action
2026-03-29 00:02:17 +00:00

100 lines
2.5 KiB
YAML

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: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
publish-gitea:
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- 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