Skip to content

Commit 42bf0f6

Browse files
committed
Adjusting the release to support the version matrix
1 parent 202a8a1 commit 42bf0f6

File tree

1 file changed

+45
-44
lines changed

1 file changed

+45
-44
lines changed

.github/workflows/release.yml

Lines changed: 45 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -6,53 +6,54 @@ on:
66
- 'v*' # Trigger on version tags
77

88
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
python-version: ["3.10", "3.11", "3.12"]
14+
steps:
15+
- uses: actions/checkout@v4
16+
- name: Set up Python
17+
uses: actions/setup-python@v4
18+
with:
19+
python-version: ${{ matrix.python-version }}
20+
- name: Install build tools
21+
run: |
22+
python -m pip install --upgrade pip
23+
pip install build
24+
- name: Build wheel and sdist
25+
run: python -m build
26+
- name: Upload dist artifacts
27+
uses: actions/upload-artifact@v4
28+
with:
29+
name: dist-${{ matrix.python-version }}
30+
path: dist/*
31+
932
release:
33+
needs: build
1034
runs-on: ubuntu-latest
11-
permissions:
12-
contents: write # Needed for creating releases
13-
1435
steps:
15-
- uses: actions/checkout@v4
16-
17-
- name: Set up Python
18-
uses: actions/setup-python@v4
19-
with:
20-
python-version: '3.10'
21-
22-
- name: Install dependencies
23-
run: |
24-
python -m pip install --upgrade pip
25-
pip install poetry twine
26-
poetry install --with dev
27-
28-
- name: Run tests
29-
run: poetry run pytest
30-
31-
- name: Build package
32-
run: poetry build
33-
34-
- name: Get version from tag
35-
id: get_version
36-
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
37-
38-
- name: Create Release
39-
uses: softprops/action-gh-release@v1
40-
with:
41-
name: Release ${{ steps.get_version.outputs.VERSION }}
42-
draft: false
43-
prerelease: false
44-
files: |
45-
dist/*
46-
body: |
47-
Release of version ${{ steps.get_version.outputs.VERSION }}
48-
49-
Please refer to [CHANGELOG.md](./CHANGELOG.md) for details.
50-
51-
- name: Publish to PyPI
52-
env:
53-
TWINE_USERNAME: __token__
54-
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
55-
run: twine upload dist/*
36+
- uses: actions/checkout@v4
37+
- name: Download all build artifacts
38+
uses: actions/download-artifact@v4
39+
with:
40+
path: dist-all
41+
- name: Combine all wheels and sdist
42+
run: |
43+
mkdir -p dist
44+
find dist-all -type f -exec cp {} dist/ \;
45+
- name: Publish to PyPI
46+
env:
47+
TWINE_USERNAME: __token__
48+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
49+
run: |
50+
python -m pip install --upgrade pip
51+
pip install twine
52+
twine upload dist/*
53+
- name: Create Release
54+
uses: softprops/action-gh-release@v1
55+
with:
56+
files: dist/*
5657

5758
docs:
5859
needs: release

0 commit comments

Comments
 (0)