| 1 |
name: Make release |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
tags: |
| 6 |
- '*' |
| 7 |
workflow_dispatch: |
| 8 |
|
| 9 |
jobs: |
| 10 |
sdist: |
| 11 |
name: Build source distribution and architecture-independent wheel |
| 12 |
runs-on: ubuntu-latest |
| 13 |
steps: |
| 14 |
- name: Check out repository |
| 15 |
uses: actions/checkout@v7 |
| 16 |
- name: Install Python 3.x |
| 17 |
uses: actions/setup-python@v7 |
| 18 |
with: |
| 19 |
python-version: 3.x |
| 20 |
- name: Install build |
| 21 |
run: pip install build |
| 22 |
- name: Build sdist & wheel |
| 23 |
run: python -m build |
| 24 |
env: |
| 25 |
BUILD_EXTENSION: no |
| 26 |
- name: Save sdist & wheel |
| 27 |
uses: actions/upload-artifact@v7 |
| 28 |
with: |
| 29 |
name: dist-architecture-independent |
| 30 |
path: | |
| 31 |
dist/*.tar.gz |
| 32 |
dist/*.whl |
| 33 |
|
| 34 |
wheels: |
| 35 |
name: Build architecture-specific wheels on ${{ matrix.os }} |
| 36 |
runs-on: ${{ matrix.os }} |
| 37 |
strategy: |
| 38 |
matrix: |
| 39 |
os: |
| 40 |
- ubuntu-latest |
| 41 |
- windows-latest |
| 42 |
- macOS-latest |
| 43 |
steps: |
| 44 |
- name: Check out repository |
| 45 |
uses: actions/checkout@v7 |
| 46 |
- name: Install Python 3.x |
| 47 |
uses: actions/setup-python@v7 |
| 48 |
with: |
| 49 |
python-version: 3.x |
| 50 |
- name: Set up QEMU |
| 51 |
if: runner.os == 'Linux' |
| 52 |
uses: docker/setup-qemu-action@v4 |
| 53 |
with: |
| 54 |
platforms: all |
| 55 |
- name: Build wheels |
| 56 |
uses: pypa/[email protected] |
| 57 |
env: |
| 58 |
BUILD_EXTENSION: yes |
| 59 |
- name: Save wheels |
| 60 |
uses: actions/upload-artifact@v7 |
| 61 |
with: |
| 62 |
name: dist-${{ matrix.os }} |
| 63 |
path: wheelhouse/*.whl |
| 64 |
timeout-minutes: 90 |
| 65 |
|
| 66 |
upload: |
| 67 |
name: Upload |
| 68 |
needs: |
| 69 |
- sdist |
| 70 |
- wheels |
| 71 |
runs-on: ubuntu-latest |
| 72 |
# Don't release when running the workflow manually from GitHub's UI. |
| 73 |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') |
| 74 |
permissions: |
| 75 |
id-token: write |
| 76 |
attestations: write |
| 77 |
artifact-metadata: write |
| 78 |
contents: write |
| 79 |
steps: |
| 80 |
- name: Download artifacts |
| 81 |
uses: actions/download-artifact@v8 |
| 82 |
with: |
| 83 |
pattern: dist-* |
| 84 |
merge-multiple: true |
| 85 |
path: dist |
| 86 |
- name: Attest provenance |
| 87 |
uses: actions/attest@v4 |
| 88 |
with: |
| 89 |
subject-path: dist/* |
| 90 |
- name: Upload to PyPI |
| 91 |
uses: pypa/gh-action-pypi-publish@release/v1 |
| 92 |
- name: Create GitHub release |
| 93 |
env: |
| 94 |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 95 |
run: gh release -R python-websockets/websockets create ${{ github.ref_name }} --notes "See https://websockets.readthedocs.io/en/stable/project/changelog.html for details." |
| 96 |
timeout-minutes: 5 |