Skip to content

Commit 1233acd

Browse files
feat: add v5 CI and publish workflows (#765)
### Changes Adds two GitHub Actions workflows to support the `v5 `SDK development and release process: 1. **CI Workflow** - Automated testing on v5 branch 2. **Publish Workflow** - Manual releases to PyPI/TestPyPI
1 parent 7c492bf commit 1233acd

File tree

3 files changed

+153
-1
lines changed

3 files changed

+153
-1
lines changed

.github/workflows/v5-ci.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Test (v5)
2+
3+
on:
4+
push:
5+
branches:
6+
- v5
7+
pull_request:
8+
branches:
9+
- v5
10+
jobs:
11+
compile:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout repo
15+
uses: actions/checkout@v4
16+
- name: Set up python
17+
uses: actions/setup-python@v4
18+
with:
19+
python-version: 3.8
20+
- name: Bootstrap poetry
21+
run: |
22+
curl -sSL https://install.python-poetry.org | python - -y --version 1.5.1
23+
- name: Install dependencies
24+
run: poetry install
25+
- name: Compile
26+
run: poetry run mypy .
27+
test:
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: Checkout repo
31+
uses: actions/checkout@v4
32+
- name: Set up python
33+
uses: actions/setup-python@v4
34+
with:
35+
python-version: 3.8
36+
- name: Bootstrap poetry
37+
run: |
38+
curl -sSL https://install.python-poetry.org | python - -y --version 1.5.1
39+
- name: Install dependencies
40+
run: poetry install
41+
42+
- name: Test
43+
run: poetry run pytest -rP .

.github/workflows/v5-publish.yml

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
name: Publish Release (v5)
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
environment:
7+
description: 'Target environment'
8+
type: choice
9+
required: true
10+
options:
11+
- testpypi
12+
- pypi
13+
default: 'testpypi'
14+
pull_request:
15+
branches:
16+
- v5
17+
18+
permissions:
19+
contents: write
20+
id-token: write
21+
22+
jobs:
23+
publish-pypi:
24+
name: "PyPI"
25+
runs-on: ubuntu-latest
26+
environment: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.environment || 'testpypi' }}
27+
28+
steps:
29+
- name: Checkout code
30+
uses: actions/checkout@v5
31+
with:
32+
fetch-depth: 0
33+
fetch-tags: true
34+
35+
- id: get_version
36+
name: Get version from pyproject.toml
37+
run: |
38+
VERSION=$(grep '^version = ' pyproject.toml | sed 's/version = "\(.*\)"/\1/')
39+
echo "version=$VERSION" >> $GITHUB_OUTPUT
40+
echo "Version: $VERSION"
41+
42+
- id: get_prerelease
43+
name: Determine if pre-release
44+
run: |
45+
VERSION="${{ steps.get_version.outputs.version }}"
46+
if [[ "$VERSION" =~ (a|alpha|b|beta|rc)[0-9]* ]]; then
47+
echo "prerelease=true" >> $GITHUB_OUTPUT
48+
echo "Pre-release: true"
49+
else
50+
echo "prerelease=false" >> $GITHUB_OUTPUT
51+
echo "Stable release"
52+
fi
53+
54+
- name: Create GitHub Release
55+
if: github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'pypi'
56+
id: create_release
57+
uses: actions/create-release@v1
58+
env:
59+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60+
with:
61+
tag_name: v${{ steps.get_version.outputs.version }}
62+
release_name: v${{ steps.get_version.outputs.version }}
63+
body: |
64+
See [v5_MIGRATION_GUIDE.md](https://github.com/${{ github.repository }}/blob/main/v5_MIGRATION_GUIDE.md) for migration instructions.
65+
draft: false
66+
prerelease: ${{ steps.get_prerelease.outputs.prerelease }}
67+
68+
- name: Configure Python
69+
uses: actions/setup-python@v6
70+
with:
71+
python-version: "3.10"
72+
73+
- name: Configure dependencies
74+
run: |
75+
pip install --user --upgrade pip
76+
pip install --user pipx
77+
pipx ensurepath
78+
pipx install poetry
79+
poetry config virtualenvs.in-project true
80+
poetry install
81+
82+
- name: Build release
83+
run: |
84+
poetry build
85+
ls -lh dist/
86+
echo "Build successful! Artifacts created:"
87+
ls -lh dist/
88+
89+
- name: Publish to Test PyPI
90+
if: github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'testpypi'
91+
uses: pypa/gh-action-pypi-publish@release/v1
92+
with:
93+
repository-url: https://test.pypi.org/legacy/
94+
skip-existing: true
95+
print-hash: true
96+
97+
- name: Publish to PyPI
98+
if: github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'pypi'
99+
uses: pypa/gh-action-pypi-publish@release/v1
100+
with:
101+
print-hash: true
102+
103+
- name: Summary
104+
run: |
105+
echo "### Release Summary" >> $GITHUB_STEP_SUMMARY
106+
echo "" >> $GITHUB_STEP_SUMMARY
107+
echo "- Version: ${{ steps.get_version.outputs.version }}" >> $GITHUB_STEP_SUMMARY
108+
echo "- Environment: ${{ github.event.inputs.environment }}" >> $GITHUB_STEP_SUMMARY
109+
echo "- Pre-release: ${{ steps.get_prerelease.outputs.prerelease }}" >> $GITHUB_STEP_SUMMARY

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ responses==0.23.3 ; python_version >= "3.7" and python_version < "4.0"
3535
tomli==2.2.1 ; python_version >= "3.7" and python_full_version <= "3.11.0a6"
3636
types-pyyaml==6.0.12.20250915 ; python_version >= "3.7" and python_version < "4.0"
3737
typing-extensions==4.7.1 ; python_version >= "3.7" and python_version < "3.8"
38-
urllib3==2.5.0 ; python_version >= "3.7" and python_version < "4.0"
38+
urllib3==2.6.0 ; python_version >= "3.7" and python_version < "4.0"
3939
userpath==1.9.2 ; python_version >= "3.7" and python_version < "4.0"
4040
yarl==1.20.0 ; python_version >= "3.7" and python_version < "4.0"
4141
zipp==3.19.1 ; python_version >= "3.7" and python_version < "3.8"

0 commit comments

Comments
 (0)