Skip to content

Commit c24d36d

Browse files
committed
fix publish job
1 parent bb85233 commit c24d36d

File tree

1 file changed

+76
-71
lines changed

1 file changed

+76
-71
lines changed

.github/workflows/build_test.yml

Lines changed: 76 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on:
44
push:
55
branches:
66
- master
7+
tags:
8+
- "v*"
79
pull_request:
810
branches:
911
- master
@@ -14,8 +16,8 @@ concurrency:
1416
cancel-in-progress: true
1517

1618
env:
17-
LATEST_PY_VERSION: '3.14'
18-
REDIS: 'redis://localhost:6379'
19+
LATEST_PY_VERSION: "3.14"
20+
REDIS: "redis://localhost:6379"
1921

2022
jobs:
2123
smoke:
@@ -48,33 +50,33 @@ jobs:
4850
fail-fast: true
4951
matrix:
5052
include:
51-
- os: macos-latest
52-
python-version: '3.14'
53-
#- os: windows-latest
54-
# python-version: '3.14'
55-
- os: ubuntu-latest
56-
python-version: 'pypy3.11'
53+
- os: macos-latest
54+
python-version: "3.14"
55+
#- os: windows-latest
56+
# python-version: '3.14'
57+
- os: ubuntu-latest
58+
python-version: "pypy3.11"
5759
steps:
58-
- name: Check out code
59-
uses: actions/checkout@v4
60-
with:
61-
fetch-depth: 0
62-
fetch-tags: true
63-
- name: Set up Python ${{ matrix.python-version }}
64-
uses: actions/setup-python@v5
65-
with:
66-
python-version: ${{ matrix.python-version }}
67-
allow-prereleases: true
68-
- name: Install uv
69-
uses: astral-sh/setup-uv@v6
70-
with:
71-
enable-cache: true
72-
python-version: ${{ matrix.python-version }}
73-
- name: Install dependencies
74-
run: uv sync --all-groups
75-
- name: Test and Coverage
76-
run: |
77-
uv run nox -e notlinux
60+
- name: Check out code
61+
uses: actions/checkout@v4
62+
with:
63+
fetch-depth: 0
64+
fetch-tags: true
65+
- name: Set up Python ${{ matrix.python-version }}
66+
uses: actions/setup-python@v5
67+
with:
68+
python-version: ${{ matrix.python-version }}
69+
allow-prereleases: true
70+
- name: Install uv
71+
uses: astral-sh/setup-uv@v6
72+
with:
73+
enable-cache: true
74+
python-version: ${{ matrix.python-version }}
75+
- name: Install dependencies
76+
run: uv sync --all-groups
77+
- name: Test and Coverage
78+
run: |
79+
uv run nox -e notlinux
7880
7981
check-linux:
8082
needs: smoke
@@ -105,53 +107,56 @@ jobs:
105107
--health-cmd "pg_isready -U postgres"
106108
--health-interval 10s --health-timeout 5s --health-retries 5
107109
steps:
108-
- name: Check out code
109-
uses: actions/checkout@v4
110-
with:
111-
fetch-depth: 0
112-
fetch-tags: true
113-
- name: Set up Python ${{ matrix.python-version }}
114-
uses: actions/setup-python@v5
115-
with:
116-
python-version: ${{ matrix.python-version }}
117-
- name: Install uv
118-
uses: astral-sh/setup-uv@v6
119-
with:
120-
enable-cache: true
121-
python-version: ${{ matrix.python-version }}
122-
- name: Install dependencies
123-
run: uv sync --all-groups
124-
# Run linting (latest python version only)
125-
- name: Build and install package
126-
if: ${{ matrix.python-version == env.LATEST_PY_VERSION && matrix.os == 'ubuntu-latest' }}
127-
run: |
128-
uv build
129-
uv pip install dist/*.whl
130-
# Run tests and coverage report (all python versions)
131-
- name: Test and Coverage
132-
run: |
133-
uv run nox -e cover
134-
# Latest python version: send coverage report to codecov
135-
- name: "Upload coverage report to Codecov"
136-
if: ${{ matrix.python-version == env.LATEST_PY_VERSION && matrix.os == 'ubuntu-latest' }}
137-
uses: codecov/codecov-action@v2
110+
- name: Check out code
111+
uses: actions/checkout@v4
112+
with:
113+
fetch-depth: 0
114+
fetch-tags: true
115+
- name: Set up Python ${{ matrix.python-version }}
116+
uses: actions/setup-python@v5
117+
with:
118+
python-version: ${{ matrix.python-version }}
119+
- name: Install uv
120+
uses: astral-sh/setup-uv@v6
121+
with:
122+
enable-cache: true
123+
python-version: ${{ matrix.python-version }}
124+
- name: Install dependencies
125+
run: uv sync --all-groups
126+
# Run linting (latest python version only)
127+
- name: Build and install package
128+
if: ${{ matrix.python-version == env.LATEST_PY_VERSION && matrix.os == 'ubuntu-latest' }}
129+
run: |
130+
uv build
131+
uv pip install dist/*.whl
132+
# Run tests and coverage report (all python versions)
133+
- name: Test and Coverage
134+
run: |
135+
uv run nox -e cover
136+
# Latest python version: send coverage report to codecov
137+
- name: "Upload coverage report to Codecov"
138+
if: ${{ matrix.python-version == env.LATEST_PY_VERSION && matrix.os == 'ubuntu-latest' }}
139+
uses: codecov/codecov-action@v2
138140

139-
- name: Upload dist, if this is latest
140-
if: ${{ matrix.python-version == env.LATEST_PY_VERSION && matrix.os == 'ubuntu-latest' }}
141-
uses: actions/upload-artifact@v4
142-
with:
143-
name: dist
144-
path: dist
141+
- name: Upload dist, if this is latest
142+
if: ${{ matrix.python-version == env.LATEST_PY_VERSION && matrix.os == 'ubuntu-latest' }}
143+
uses: actions/upload-artifact@v4
144+
with:
145+
name: dist
146+
path: dist
145147

146148
publish:
147149
needs: [check-linux, check-others]
148150
runs-on: ubuntu-latest
149151
if: startsWith(github.ref, 'refs/tags/v')
152+
permissions:
153+
contents: read
154+
id-token: write
150155
steps:
151-
- name: Download dist
152-
uses: actions/download-artifact@v4
153-
with:
154-
name: dist
155-
path: dist
156-
- name: Upload package to PyPI
157-
uses: pypa/gh-action-pypi-publish@release/v1
156+
- name: Download dist
157+
uses: actions/download-artifact@v4
158+
with:
159+
name: dist
160+
path: dist
161+
- name: Upload package to PyPI
162+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)