kwork-api/.gitea/workflows/release.yml
root 0c22b31e1c
Some checks failed
Release & Publish / build (push) Failing after 2m31s
Release & Publish / publish-gitea (push) Has been skipped
Release & Publish / docs (push) Has been skipped
ci: setup complete CI/CD with PR checks, release pipeline, and conventions
- Add PR checks workflow (tests, lint, security, commitlint)
- Add release workflow (build, publish to Gitea, deploy docs)
- Add pre-commit hooks (ruff, format, commitlint)
- Add CONTRIBUTING.md with development guidelines
- Add commitlint configuration
- Rename master → main branch
- Configure ruff, pytest, coverage in pyproject.toml
2026-03-28 23:38:19 +00:00

109 lines
2.7 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: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install UV
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
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: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install UV
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
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