Skip to content

Commit 26b9862

Browse files
committed
Upgrade GitHub Actions
1 parent ebb8c42 commit 26b9862

File tree

2 files changed

+32
-42
lines changed

2 files changed

+32
-42
lines changed

.github/workflows/publish.yml

+22-29
Original file line numberDiff line numberDiff line change
@@ -4,55 +4,48 @@ on:
44
release:
55
types: [created]
66

7+
permissions:
8+
contents: read
9+
710
jobs:
811
test:
912
runs-on: ubuntu-latest
1013
strategy:
1114
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"]
1316
steps:
14-
- uses: actions/checkout@v2
17+
- uses: actions/checkout@v4
1518
- name: Set up Python ${{ matrix.python-version }}
16-
uses: actions/setup-python@v2
19+
uses: actions/setup-python@v5
1720
with:
1821
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
2624
- name: Install dependencies
2725
run: |
28-
pip install -e '.[test]'
26+
pip install '.[test]'
2927
- name: Run tests
3028
run: |
3129
pytest
3230
deploy:
3331
runs-on: ubuntu-latest
3432
needs: [test]
33+
environment: release
34+
permissions:
35+
id-token: write
3536
steps:
36-
- uses: actions/checkout@v2
37+
- uses: actions/checkout@v4
3738
- 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
4340
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
4844
- name: Install dependencies
4945
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
5548
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

.github/workflows/test.yml

+10-13
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,27 @@
11
name: Test
22

3-
on: [push]
3+
on: [push, pull_request]
4+
5+
permissions:
6+
contents: read
47

58
jobs:
69
test:
710
runs-on: ubuntu-latest
811
strategy:
912
matrix:
10-
python-version: [3.6, 3.7, 3.8, 3.9]
13+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
1114
steps:
12-
- uses: actions/checkout@v2
15+
- uses: actions/checkout@v4
1316
- name: Set up Python ${{ matrix.python-version }}
14-
uses: actions/setup-python@v2
17+
uses: actions/setup-python@v5
1518
with:
1619
python-version: ${{ matrix.python-version }}
17-
- uses: actions/cache@v2
18-
name: Configure pip caching
19-
with:
20-
path: ~/.cache/pip
21-
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
22-
restore-keys: |
23-
${{ runner.os }}-pip-
20+
cache: pip
21+
cache-dependency-path: setup.py
2422
- name: Install dependencies
2523
run: |
26-
pip install -e '.[test]'
24+
pip install '.[test]'
2725
- name: Run tests
2826
run: |
2927
pytest
30-

0 commit comments

Comments
 (0)