Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/v5-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Test (v5)

on:
push:
branches:
- v5
pull_request:
branches:
- v5
jobs:
compile:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up python
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Bootstrap poetry
run: |
curl -sSL https://install.python-poetry.org | python - -y --version 1.5.1
- name: Install dependencies
run: poetry install
- name: Compile
run: poetry run mypy .
test:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up python
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Bootstrap poetry
run: |
curl -sSL https://install.python-poetry.org | python - -y --version 1.5.1
- name: Install dependencies
run: poetry install

- name: Test
run: poetry run pytest -rP .
109 changes: 109 additions & 0 deletions .github/workflows/v5-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: Publish Release (v5)

on:
workflow_dispatch:
inputs:
environment:
description: 'Target environment'
type: choice
required: true
options:
- testpypi
- pypi
default: 'testpypi'
pull_request:
branches:
- v5

permissions:
contents: write
id-token: write

jobs:
publish-pypi:
name: "PyPI"
runs-on: ubuntu-latest
environment: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.environment || 'testpypi' }}

steps:
- name: Checkout code
uses: actions/checkout@v5
with:
fetch-depth: 0
fetch-tags: true

- id: get_version
name: Get version from pyproject.toml
run: |
VERSION=$(grep '^version = ' pyproject.toml | sed 's/version = "\(.*\)"/\1/')
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Version: $VERSION"

- id: get_prerelease
name: Determine if pre-release
run: |
VERSION="${{ steps.get_version.outputs.version }}"
if [[ "$VERSION" =~ (a|alpha|b|beta|rc)[0-9]* ]]; then
echo "prerelease=true" >> $GITHUB_OUTPUT
echo "Pre-release: true"
else
echo "prerelease=false" >> $GITHUB_OUTPUT
echo "Stable release"
fi

- name: Create GitHub Release
if: github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'pypi'
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.get_version.outputs.version }}
release_name: v${{ steps.get_version.outputs.version }}
body: |
See [v5_MIGRATION_GUIDE.md](https://github.com/${{ github.repository }}/blob/main/v5_MIGRATION_GUIDE.md) for migration instructions.
draft: false
prerelease: ${{ steps.get_prerelease.outputs.prerelease }}

- name: Configure Python
uses: actions/setup-python@v6
with:
python-version: "3.10"

- name: Configure dependencies
run: |
pip install --user --upgrade pip
pip install --user pipx
pipx ensurepath
pipx install poetry
poetry config virtualenvs.in-project true
poetry install

- name: Build release
run: |
poetry build
ls -lh dist/
echo "Build successful! Artifacts created:"
ls -lh dist/

- name: Publish to Test PyPI
if: github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'testpypi'
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
skip-existing: true
print-hash: true

- name: Publish to PyPI
if: github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'pypi'
uses: pypa/gh-action-pypi-publish@release/v1
with:
print-hash: true

- name: Summary
run: |
echo "### Release Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "- Version: ${{ steps.get_version.outputs.version }}" >> $GITHUB_STEP_SUMMARY
echo "- Environment: ${{ github.event.inputs.environment }}" >> $GITHUB_STEP_SUMMARY
echo "- Pre-release: ${{ steps.get_prerelease.outputs.prerelease }}" >> $GITHUB_STEP_SUMMARY
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ responses==0.23.3 ; python_version >= "3.7" and python_version < "4.0"
tomli==2.2.1 ; python_version >= "3.7" and python_full_version <= "3.11.0a6"
types-pyyaml==6.0.12.20250915 ; python_version >= "3.7" and python_version < "4.0"
typing-extensions==4.7.1 ; python_version >= "3.7" and python_version < "3.8"
urllib3==2.5.0 ; python_version >= "3.7" and python_version < "4.0"
urllib3==2.6.0 ; python_version >= "3.7" and python_version < "4.0"
userpath==1.9.2 ; python_version >= "3.7" and python_version < "4.0"
yarl==1.20.0 ; python_version >= "3.7" and python_version < "4.0"
zipp==3.19.1 ; python_version >= "3.7" and python_version < "3.8"
Loading