Skip to content
Merged
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
40 changes: 25 additions & 15 deletions .github/workflows/pypi-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
push:
branches:
- main
- v2
- 'tag/v**'

jobs:
Expand All @@ -15,17 +16,23 @@ jobs:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Set up Python
run: uv python install 3.12
- name: Install the project
run: uv sync --all-extras --dev

- name: Build SDist and wheel
run: pipx run build
run: uv run build

- uses: actions/upload-artifact@v5
with:
name: artifact
path: dist/*

- name: Check metadata
run: pipx run twine check dist/*
run: uv run twine check dist/*
publish:
runs-on: ubuntu-24.04
if: github.event_name == 'push'
Expand All @@ -34,25 +41,28 @@ jobs:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.11"
cache: 'pip'
- name: Install build dependencies
run: pip install -U setuptools wheel build
- uses: actions/download-artifact@v5
with:
# unpacks default artifact into dist/
# if `name: artifact` is omitted, the action will create extra parent dir
name: artifact
path: dist
- name: Publish
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.pypi_password }}
- name: Install GitPython and cloudevents for pypi_packaging
run: pip install -U -r requirements/publish.txt
- name: Create Tag
run: python pypi_packaging.py
tag:
runs-on: ubuntu-24.04
needs: [ publish ]
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Extract version
id: version
run: |
echo "version=$(grep -oP '__version__ = \"\K[^\"]+' src/cloudevents/__init__.py)" >> $GITHUB_OUTPUT
- name: Create and push tag
uses: pxpm/github-tag-action@1.0.1
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
tag: ${{ steps.version.outputs.version }}