Skip to content

Commit fef565b

Browse files
committed
Add test publish step
Build and publish a test version of the package to TestPypi on every build.
1 parent 436e979 commit fef565b

1 file changed

Lines changed: 50 additions & 6 deletions

File tree

.github/workflows/main.yml

Lines changed: 50 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,7 @@ jobs:
5050
- name: Test
5151
run: pixi run lint
5252

53-
deploy:
54-
55-
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
53+
build:
5654

5755
runs-on: ubuntu-latest
5856

@@ -66,11 +64,57 @@ jobs:
6664
- name: Build package
6765
run: |
6866
pixi run -e build build
69-
- name: Publish package to PyPI
67+
- name: Archive build artifacts
68+
uses: actions/upload-artifact@v4
69+
with:
70+
name: dist
71+
path: |
72+
dist
73+
74+
pypi-test-publish:
75+
name: Test upload release sending package to TestPyPI
76+
runs-on: ubuntu-latest
77+
needs: build
78+
environment:
79+
name: testpypi
80+
url: https://test.pypi.org/p/serialchemy
81+
permissions:
82+
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
83+
steps:
84+
- name: Load build artifacts
85+
uses: actions/download-artifact@v4
86+
with:
87+
name: dist
88+
path: |
89+
dist
90+
91+
- name: Publish package distributions to TestPyPI
7092
uses: pypa/gh-action-pypi-publish@release/v1
7193
with:
72-
user: __token__
73-
password: ${{ secrets.pypi_token }}
94+
repository-url: https://test.pypi.org/legacy/
95+
96+
pypi-publish:
97+
98+
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
99+
100+
name: Test upload release sending package to TestPyPI
101+
runs-on: ubuntu-latest
102+
needs: build
103+
environment:
104+
name: pypi
105+
url: https://pypi.org/p/serialchemy
106+
permissions:
107+
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
108+
steps:
109+
- name: Load build artifacts
110+
uses: actions/download-artifact@v4
111+
with:
112+
name: dist
113+
path: |
114+
dist
115+
116+
- name: Publish package distributions to PyPI
117+
uses: pypa/gh-action-pypi-publish@release/v1
74118

75119
sonarcloud:
76120

0 commit comments

Comments
 (0)