Skip to content

Commit 8957662

Browse files
authored
fix: also publish to testpypi for PRs against release branches (#170)
1 parent 0d66817 commit 8957662

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

.github/workflows/pypi.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,16 @@ on:
88
pull_request:
99
branches:
1010
- main
11+
- '[0-9]+.[0-9]+.[0-9]+' # Match M.m.hf pattern (e.g., 1.2.3, 2.0.1, etc.)
1112

1213
jobs:
1314
testpypipublish:
1415
name: Build and Publish Test Distribution
1516
runs-on: ubuntu-latest
17+
if: |
18+
github.event_name == 'pull_request' &&
19+
github.event.pull_request.head.repo.full_name == github.repository &&
20+
(github.base_ref == 'main' || contains(github.base_ref, '.'))
1621
steps:
1722
- name: Checkout
1823
uses: actions/checkout@v3
@@ -31,12 +36,15 @@ jobs:
3136
env:
3237
DEVBUILD: 1
3338
- name: Publish distribution package to Test PyPI
34-
if: github.event.pull_request.head.repo.full_name == github.repository
39+
if: |
40+
github.event.pull_request.head.repo.full_name == github.repository &&
41+
github.event_name == 'pull_request' &&
42+
(github.base_ref == 'main' || contains(github.base_ref, '.'))
3543
uses: pypa/gh-action-pypi-publish@release/v1
3644
with:
3745
user: __token__
3846
password: ${{ secrets.PYPITEST_PASSWORD }}
39-
repository_url: https://test.pypi.org/legacy/
47+
repository-url: https://test.pypi.org/legacy/
4048
pypipublish:
4149
name: Build and Publish Production Distribution
4250
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)