mirror of
https://github.com/vladkens/twscrape.git
synced 2026-10-30 06:58:10 -04:00
60 lines
1.7 KiB
YAML
60 lines
1.7 KiB
YAML
name: build
|
|
|
|
on:
|
|
push:
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
- run: uv sync --frozen
|
|
- run: make check
|
|
- run: make test
|
|
|
|
release:
|
|
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
|
|
runs-on: ubuntu-latest
|
|
needs: test
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
|
|
|
- name: Check pyproject.toml version matches tag
|
|
run: |
|
|
TAG="${{ github.ref_name }}"
|
|
PKG_VERSION="v$(grep '^version = ' pyproject.toml | cut -d'"' -f2)"
|
|
if [ "$TAG" != "$PKG_VERSION" ]; then
|
|
echo "Error: tag ${TAG} does not match pyproject.toml version ${PKG_VERSION}"
|
|
exit 1
|
|
fi
|
|
|
|
- run: uv build
|
|
|
|
- name: Extract changelog entry
|
|
run: |
|
|
VERSION="${{ github.ref_name }}"
|
|
NOTES=$(awk "/^## ${VERSION}/{found=1; next} /^## /{found=0} found" changelog.md)
|
|
if [ -z "$NOTES" ]; then
|
|
echo "Error: no changelog entry found for ${VERSION}"
|
|
exit 1
|
|
fi
|
|
echo "$NOTES" > release_notes.txt
|
|
|
|
- run: uv publish
|
|
env:
|
|
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
|
|
|
|
- run: gh release create ${{ github.ref_name }} --title ${{ github.ref_name }} --notes-file release_notes.txt
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|