Skip to content

Commit dc6a48c

Browse files
committed
chore(ci): split test, build, and publish to separate jobs
Mostly for better targeted permissions.
1 parent 5f53205 commit dc6a48c

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

.github/workflows/main.yml

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
with:
1919
python-version: 3.13
2020
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
21-
build:
21+
test:
2222
runs-on: ubuntu-latest
2323
strategy:
2424
matrix:
@@ -37,24 +37,28 @@ jobs:
3737
uses: fedora-python/tox-github-action@807f27871410c7391018dc9a245c8cffdced15e9 # v41.0
3838
with:
3939
tox_env: ${{ matrix.tox_env }}
40-
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
41-
with:
42-
cache: pip
43-
cache-dependency-path: |
44-
requirements-dev.txt
45-
setup.py
46-
deploy:
47-
name: Build and publish to PyPI
40+
build:
4841
runs-on: ubuntu-latest
4942
permissions:
5043
contents: read
51-
id-token: write
5244
steps:
5345
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
5446
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
5547
- run: python -m pip install --upgrade build
5648
- run: python -m build
57-
- uses: pypa/gh-action-pypi-publish@release/v1
49+
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
50+
with:
51+
name: dist
52+
path: dist/
53+
publish:
54+
runs-on: ubuntu-latest
55+
needs: build
56+
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') }}
57+
permissions:
58+
id-token: write
59+
steps:
60+
- uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
5861
with:
59-
skip-existing: true
60-
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') }}
62+
name: dist
63+
path: dist/
64+
- uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0

0 commit comments

Comments
 (0)