Bump version to 0.76.3 #27
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release and Publish | |
on: | |
push: | |
tags: | |
- "v*" | |
jobs: | |
# First run tests across all platforms | |
matrix-test: | |
uses: ./.github/workflows/test.yml | |
# Then proceed with release if tests pass | |
release-and-publish: | |
needs: matrix-test | |
runs-on: ubuntu-latest | |
environment: | |
name: release | |
url: https://pypi.org/p/klp-logviewer | |
permissions: | |
contents: write # For creating GitHub release | |
id-token: write # For PyPI publishing | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.x" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install build pytest pytest-cov | |
pip install -e ".[test]" | |
- name: Run tests | |
run: | | |
pytest tests/ -v --cov=klp --cov-report=term-missing | |
- name: Check version consistency | |
run: | | |
# Get the version from klp.py | |
echo "Checking klp.py..." | |
KLP_VERSION=$(PYTHONPATH=. python3 -c "import klp; print(klp.__version__)") | |
# Get the tag version | |
TAG_VERSION=${GITHUB_REF#refs/tags/v} | |
echo "klp.py version: $KLP_VERSION" | |
echo "Tag version: $TAG_VERSION" | |
if [ "$KLP_VERSION" != "$TAG_VERSION" ]; then | |
echo "Error: Version mismatch!" | |
echo "Version in klp.py ($KLP_VERSION) does not match git tag ($TAG_VERSION)" | |
exit 1 | |
fi | |
echo "Version consistency check passed" | |
- name: Install build tools | |
run: | | |
python -m pip install --upgrade pip | |
pip install build | |
# Build PyPI package first | |
- name: Build package | |
run: python -m build | |
# Create GitHub Release assets | |
- name: Create source archive | |
run: | | |
mkdir -p release/examples | |
cp LICENSE README.md klp.py pyproject.toml release/ | |
cp examples/mylog.logfmt release/examples/ | |
cd release && zip -r ../klp-${{ github.ref_name }}.zip * | |
# Create GitHub Release with both source and built distributions | |
- name: Create Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
name: Release ${{ github.ref_name }} | |
draft: false | |
prerelease: false | |
generate_release_notes: true | |
files: | | |
klp-${{ github.ref_name }}.zip | |
dist/* | |
# Publish to PyPI | |
- name: Publish to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 |