|
4 | 4 | release:
|
5 | 5 | types: [created]
|
6 | 6 |
|
| 7 | +permissions: |
| 8 | + contents: read |
| 9 | + |
7 | 10 | jobs:
|
8 | 11 | test:
|
9 | 12 | runs-on: ubuntu-latest
|
10 | 13 | strategy:
|
11 | 14 | matrix:
|
12 |
| - python-version: [3.6, 3.7, 3.8, 3.9] |
| 15 | + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] |
13 | 16 | steps:
|
14 |
| - - uses: actions/checkout@v2 |
| 17 | + - uses: actions/checkout@v4 |
15 | 18 | - name: Set up Python ${{ matrix.python-version }}
|
16 |
| - uses: actions/setup-python@v2 |
| 19 | + uses: actions/setup-python@v5 |
17 | 20 | with:
|
18 | 21 | python-version: ${{ matrix.python-version }}
|
19 |
| - - uses: actions/cache@v2 |
20 |
| - name: Configure pip caching |
21 |
| - with: |
22 |
| - path: ~/.cache/pip |
23 |
| - key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }} |
24 |
| - restore-keys: | |
25 |
| - ${{ runner.os }}-pip- |
| 22 | + cache: pip |
| 23 | + cache-dependency-path: setup.py |
26 | 24 | - name: Install dependencies
|
27 | 25 | run: |
|
28 |
| - pip install -e '.[test]' |
| 26 | + pip install '.[test]' |
29 | 27 | - name: Run tests
|
30 | 28 | run: |
|
31 | 29 | pytest
|
32 | 30 | deploy:
|
33 | 31 | runs-on: ubuntu-latest
|
34 | 32 | needs: [test]
|
| 33 | + environment: release |
| 34 | + permissions: |
| 35 | + id-token: write |
35 | 36 | steps:
|
36 |
| - - uses: actions/checkout@v2 |
| 37 | + - uses: actions/checkout@v4 |
37 | 38 | - name: Set up Python
|
38 |
| - uses: actions/setup-python@v2 |
39 |
| - with: |
40 |
| - python-version: '3.9' |
41 |
| - - uses: actions/cache@v2 |
42 |
| - name: Configure pip caching |
| 39 | + uses: actions/setup-python@v5 |
43 | 40 | with:
|
44 |
| - path: ~/.cache/pip |
45 |
| - key: ${{ runner.os }}-publish-pip-${{ hashFiles('**/setup.py') }} |
46 |
| - restore-keys: | |
47 |
| - ${{ runner.os }}-publish-pip- |
| 41 | + python-version: "3.12" |
| 42 | + cache: pip |
| 43 | + cache-dependency-path: setup.py |
48 | 44 | - name: Install dependencies
|
49 | 45 | run: |
|
50 |
| - pip install setuptools wheel twine |
51 |
| - - name: Publish |
52 |
| - env: |
53 |
| - TWINE_USERNAME: __token__ |
54 |
| - TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} |
| 46 | + pip install setuptools wheel build |
| 47 | + - name: Build |
55 | 48 | run: |
|
56 |
| - python setup.py sdist bdist_wheel |
57 |
| - twine upload dist/* |
58 |
| -
|
| 49 | + python -m build |
| 50 | + - name: Publish |
| 51 | + uses: pypa/gh-action-pypi-publish@release/v1 |
0 commit comments