Skip to content

Commit 8fc823b

Browse files
committed
feat: modernize release process
- use uv to build and publish packages - use trusted publishing instead for stored token - build and lint packages on every commit, not only on release time
1 parent ec82b56 commit 8fc823b

File tree

1 file changed

+13
-17
lines changed

1 file changed

+13
-17
lines changed

.github/workflows/release.yml

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,20 @@ name: Release
33
on:
44
release:
55
types: [published]
6+
push:
7+
pull_request:
68

79
jobs:
810
release:
911
runs-on: ubuntu-latest
12+
permissions:
13+
id-token: write
1014
steps:
1115
- uses: actions/checkout@v4
12-
13-
- name: Set up Python
14-
uses: actions/setup-python@v5
15-
with:
16-
python-version: '3.9'
17-
cache: pip
18-
cache-dependency-path: requirements*.txt
19-
20-
- name: Install Python dependencies
21-
run: |
22-
python -m pip install --upgrade pip
23-
pip install wheel twine
16+
- uses: astral-sh/setup-uv@v5
2417

2518
- name: Verify tag is documented
19+
if: github.event_name == 'release'
2620
run: |
2721
CURRENT_TAG=${GITHUB_REF#refs/tags/}
2822
CURRENT_VERSION=$(head -n1 social_core/__init__.py | awk '{print $3}' | sed 's/[^0-9\.]//g')
@@ -34,9 +28,10 @@ jobs:
3428
fi
3529
3630
- name: Build dist
37-
run: python setup.py sdist bdist_wheel --python-tag py3
31+
run: uv build
3832

3933
- name: Archive dist
34+
if: github.event_name == 'release'
4035
uses: actions/upload-artifact@v4
4136
with:
4237
name: dist
@@ -45,10 +40,11 @@ jobs:
4540
dist/*.whl
4641
4742
- name: Verify long description rendering
48-
run: twine check dist/*
43+
run: uvx twine check dist/*
4944

5045
- name: Publish
5146
env:
52-
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
53-
run: |
54-
twine upload --non-interactive -u __token__ -p "${PYPI_API_TOKEN}" dist/*
47+
# TODO: remove once trusted publishing is configured
48+
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
49+
if: github.event_name == 'release' && github.repository == 'python-social-auth/social-core'
50+
run: uv publish

0 commit comments

Comments
 (0)