Skip to content

Commit

Permalink
feat: modernize release process
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
nijel committed Jan 6, 2025
1 parent ec82b56 commit e6e8da8
Showing 1 changed file with 11 additions and 18 deletions.
29 changes: 11 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,20 @@ name: Release
on:
release:
types: [published]
push:
pull_request:

jobs:
release:
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
cache: pip
cache-dependency-path: requirements*.txt

- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install wheel twine
- uses: astral-sh/setup-uv@v5

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

- name: Archive dist
if: github.event_name == 'release'
uses: actions/upload-artifact@v4
with:
name: dist
Expand All @@ -45,10 +40,8 @@ jobs:
dist/*.whl
- name: Verify long description rendering
run: twine check dist/*
run: uvx twine check dist/*

- name: Publish
env:
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
run: |
twine upload --non-interactive -u __token__ -p "${PYPI_API_TOKEN}" dist/*
if: github.event_name == 'release' && github.repository == 'python-social-auth/social-core'
run: uv publish --trusted-publishing always

0 comments on commit e6e8da8

Please sign in to comment.