kwork-api/.gitea/workflows/release.yml
root 0975b68334 feat: complete Kwork API client with 45+ endpoints
Initial release:
- Complete async API client (45+ endpoints)
- Pydantic models for all responses
- Two-step authentication
- Comprehensive error handling
- 92% test coverage
- Gitea Actions CI/CD
- Semantic release configured
2026-03-29 00:42:54 +00:00

147 lines
4.3 KiB
YAML

name: Release & Publish
on:
push:
branches: [main]
tags:
- 'v*'
jobs:
semantic-release:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
outputs:
new_release_version: ${{ steps.semantic.outputs['new_release_version'] }}
new_release_published: ${{ steps.semantic.outputs['new_release_published'] }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITEA_TOKEN }}
- name: Use system Python
run: |
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Install dependencies
run: uv sync --group dev
- name: Run semantic-release
id: semantic
env:
GH_TOKEN: ${{ secrets.GITEA_TOKEN }}
GIT_AUTHOR_NAME: claw-bot
GIT_AUTHOR_EMAIL: claw-bot@much-data.ru
GIT_COMMITTER_NAME: claw-bot
GIT_COMMITTER_EMAIL: claw-bot@much-data.ru
run: |
uv run semantic-release version --no-push
NEW_VERSION=$(uv run python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])")
echo "new_release_version=$NEW_VERSION" >> $GITHUB_OUTPUT
# Check if version changed
if git diff --quiet pyproject.toml; then
echo "new_release_published=false" >> $GITHUB_OUTPUT
else
echo "new_release_published=true" >> $GITHUB_OUTPUT
fi
- name: Commit and push version bump
if: steps.semantic.outputs.new_release_published == 'true'
run: |
uv run semantic-release changelog
git add pyproject.toml CHANGELOG.md
git commit -m "chore(release): v${{ steps.semantic.outputs.new_release_version }} [skip ci]"
git tag v${{ steps.semantic.outputs.new_release_version }}
git push origin main --tags
build:
runs-on: ubuntu-latest
needs: [semantic-release]
if: github.ref == 'refs/tags/v*' || github.event_name == 'push'
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 "$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 (production only)
run: uv sync --no-dev
- name: Build package
run: uv build
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: dist
path: dist/
retention-days: 7
publish-gitea:
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: dist
path: dist/
- name: Publish to Gitea Packages
run: |
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 "$HOME/.local/bin" >> $GITHUB_PATH
- name: Install dependencies
run: uv sync --no-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