mirror of
https://github.com/vladkens/twscrape.git
synced 2026-10-19 20:33:59 -04:00
71 lines
2.1 KiB
YAML
71 lines
2.1 KiB
YAML
name: build
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
tags: ["v*"]
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
continue-on-error: ${{ matrix.python-version == '3.15' }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14", "3.15"]
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
- uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
|
|
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
|
|
id-token: write
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
- uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
|
|
|
|
- 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
|
|
|
|
- name: Prepare README for PyPI
|
|
run: |
|
|
BASE_URL="https://raw.githubusercontent.com/${{ github.repository }}/${{ github.ref_name }}"
|
|
sed -i "s#src=\"\\.github/#src=\"${BASE_URL}/.github/#g" readme.md
|
|
|
|
- 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
|
|
|
|
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
|
|
- run: gh release create ${{ github.ref_name }} --title ${{ github.ref_name }} --notes-file release_notes.txt
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|