- Add scripts/validate_commit_msg.py with conventional commit enforcement - Add scripts/configure_repo.py for Gitea branch protection and labels - Add scripts/__init__.py for Python package importability - Create Gitea Actions workflows: ci, auto-merge, post-merge, publish - Update .pre-commit-config.yaml with commit-msg hook - Update pyproject.toml pythonpath and coverage for scripts - Add comprehensive unit tests for both scripts with 100% coverage
41 lines
1.3 KiB
YAML
41 lines
1.3 KiB
YAML
name: Publish Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
|
|
jobs:
|
|
publish:
|
|
runs-on: docker
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Build and publish release
|
|
env:
|
|
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
|
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
|
|
run: |
|
|
python3 -m venv .venv
|
|
.venv/bin/pip install build twine
|
|
|
|
# Build package
|
|
.venv/bin/python -m build
|
|
|
|
# Publish to PyPI (only if PYPI_TOKEN secret is configured)
|
|
if [ -n "${PYPI_TOKEN}" ]; then
|
|
.venv/bin/twine upload dist/* -u __token__ -p "${PYPI_TOKEN}"
|
|
echo "Published to PyPI."
|
|
else
|
|
echo "PYPI_TOKEN not set — skipping PyPI publish."
|
|
fi
|
|
|
|
# Create Gitea release
|
|
TAG="${{ github.ref_name }}"
|
|
curl -X POST \
|
|
"https://git.oblachno.oblachno.fyi/api/v1/repos/${{ github.repository }}/releases" \
|
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
|
-H "Content-Type: application/json" \
|
|
-d "{\"tag_name\": \"${TAG}\", \"name\": \"${TAG}\", \"body\": \"Release ${TAG}\\n\\nSee CHANGELOG.md for details.\", \"draft\": false, \"prerelease\": false}"
|
|
|
|
echo "Gitea release ${TAG} created."
|