Skip to content

Commit e1ff974

Browse files
committed
Add job to publish to TestPyPI
1 parent 91e48a1 commit e1ff974

File tree

1 file changed

+40
-5
lines changed

1 file changed

+40
-5
lines changed

.github/workflows/cd.yml

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ on: # yamllint disable-line rule:truthy
4242
required: false
4343
type: boolean
4444
default: false
45+
publish-testpypi:
46+
description: 'Publish to TestPyPI'
47+
required: false
48+
type: boolean
49+
default: false
4550
publish-anaconda:
4651
description: 'Publish to Anaconda'
4752
required: false
@@ -62,9 +67,9 @@ jobs:
6267
if: ${{ inputs.publish-pypi }}
6368
runs-on: ubuntu-latest
6469
needs: wheel
65-
environment: # TODO: update url to pypi.org
70+
environment:
6671
name: pypi
67-
url: https://test.pypi.org/p/${{ inputs.mpiname }}
72+
url: https://pypi.org/project/${{ inputs.mpiname }}/
6873
permissions:
6974
contents: read
7075
id-token: write
@@ -87,15 +92,45 @@ jobs:
8792
echo '```' >> "$GITHUB_STEP_SUMMARY"
8893
working-directory: dist
8994

90-
- if: ${{ false }} # TODO: remove 'if' condition
91-
name: Attest wheel artifacts
95+
- name: Attest wheel artifacts
9296
uses: actions/attest-build-provenance@v2
9397
with:
9498
subject-path: dist/*.whl
9599

96100
- name: Publish to PyPI
97101
uses: pypa/gh-action-pypi-publish@release/v1
98-
with: # TODO: remove repository-url
102+
103+
publish-testpypi:
104+
if: ${{ inputs.publish-testpypi }}
105+
runs-on: ubuntu-latest
106+
needs: wheel
107+
environment:
108+
name: testpypi
109+
url: https://test.pypi.org/project/${{ inputs.mpiname }}/
110+
permissions:
111+
contents: read
112+
id-token: write
113+
114+
steps:
115+
116+
- name: Download wheel artifacts
117+
uses: actions/download-artifact@v4
118+
with:
119+
path: dist
120+
pattern: wheel-*
121+
merge-multiple: true
122+
123+
- name: Report sha256sum
124+
run: |
125+
# Report sha256sum
126+
echo '```' >> "$GITHUB_STEP_SUMMARY"
127+
sha256sum -b *.whl >> "$GITHUB_STEP_SUMMARY"
128+
echo '```' >> "$GITHUB_STEP_SUMMARY"
129+
working-directory: dist
130+
131+
- name: Publish to TestPyPI
132+
uses: pypa/gh-action-pypi-publish@release/v1
133+
with:
99134
repository-url: https://test.pypi.org/legacy/
100135

101136
publish-anaconda:

0 commit comments

Comments
 (0)