1- name : PyPI Publishing
1+ name : TestPyPI Publishing
22
33# SECURITY NOTE: This workflow uses PyPI Trusted Publishing (OIDC)
44# No API tokens required - authentication is handled automatically via GitHub's OIDC token
55#
6+ # This workflow publishes to TestPyPI ONLY for development testing.
7+ # Production releases to PyPI are handled by prod-release.yml
8+ #
69# Prerequisites:
7- # 1. Configure trusted publisher on PyPI: https://pypi.org/manage/account/publishing/
8- # 2. Configure trusted publisher on TestPyPI: https://test.pypi.org/manage/account/publishing/
9- # 3. See docs/deployment/pypi-setup.md for detailed setup instructions
10+ # 1. Configure trusted publisher on TestPyPI: https://test.pypi.org/manage/account/publishing/
11+ # 2. See docs/deployment/pypi-setup.md for detailed setup instructions
1012
1113env :
1214 # Comment trigger words for package publishing
2628 branches : [main]
2729 workflow_dispatch :
2830 inputs :
29- environment :
30- description : ' Environment to publish to'
31- required : true
32- default : ' testpypi'
33- type : choice
34- options :
35- - testpypi
36- - pypi
31+ force :
32+ description : ' Force publish even if version exists'
33+ required : false
34+ default : false
35+ type : boolean
3736
3837concurrency :
3938 group : " pypi-publishing"
4746 outputs :
4847 default-python-version : ${{ steps.config.outputs.default-python-version }}
4948 package-version : ${{ steps.config.outputs.package-version }}
50- is-release : ${{ steps.config.outputs.is-release }}
49+ pypi-name : ${{ steps.config.outputs.pypi-name }}
5150 steps :
5251 - name : Checkout code
5352 uses : actions/checkout@v6.0.1
6160 runs-on : ubuntu-latest
6261 needs : [get-config]
6362 environment :
64- name : ${{ needs.get-config.outputs.is-release == 'true' && 'pypi' || github.event.inputs.environment || ' testpypi' }}
65- url : ${{ needs.get-config.outputs.is-release == 'true' && 'https:// pypi.org/p/open-resource-broker' || 'https://test.pypi.org/p/open-resource-broker' }}
63+ name : testpypi
64+ url : https://test.pypi.org/p/ ${{ needs.get-config.outputs.pypi-name }}
6665 permissions :
6766 id-token : write # IMPORTANT: mandatory for trusted publishing
6867 contents : read # needed to checkout code
@@ -75,20 +74,11 @@ jobs:
7574
7675 - name : Determine version and target
7776 run : |
78- if [[ "${{ needs.get-config.outputs.is-release }}" == "true" ]]; then
79- {
80- echo "VERSION=${{ needs.get-config.outputs.package-version }}"
81- echo "TARGET=pypi"
82- echo "IS_RELEASE=true"
83- } >> "$GITHUB_ENV"
84- else
85- # Dev version for TestPyPI - use centralized version
86- {
87- echo "VERSION=${{ needs.get-config.outputs.package-version }}"
88- echo "TARGET=testpypi"
89- } >> "$GITHUB_ENV"
90- fi
91- echo "Publishing to: $TARGET with version: $VERSION"
77+ {
78+ echo "VERSION=${{ needs.get-config.outputs.package-version }}"
79+ echo "TARGET=testpypi"
80+ } >> "$GITHUB_ENV"
81+ echo "Publishing to: TestPyPI with version: $VERSION"
9282
9383 - name : Setup Python and UV
9484 uses : ./.github/actions/setup-uv-cached
@@ -110,37 +100,23 @@ jobs:
110100 verbose : true
111101 skip-existing : true
112102
113- - name : Publish to PyPI
114- if : github.event_name == 'release'
115- uses : pypa/gh-action-pypi-publish@release/v1
116- with :
117- verbose : true
118- skip-existing : true
119-
120103 - name : Create deployment summary
121104 run : |
122105 {
123106 echo "## Package Published Successfully"
124107 echo ""
125- if [ "$TARGET" = "pypi" ]; then
126- echo "**Environment:** Production PyPI"
127- echo "**Installation:** \`pip install open-resource-broker\`"
128- else
129- echo "**Environment:** Test PyPI"
130- echo "**Installation:** \`pip install --index-url https://test.pypi.org/simple/ open-resource-broker\`"
131- fi
108+ echo "**Environment:** Test PyPI"
109+ echo "**Installation:** \`pip install --index-url https://test.pypi.org/simple/ ${{ needs.get-config.outputs.pypi-name }}\`"
132110 echo ""
133111 echo "**Version:** $VERSION"
134112 echo "**Commands:**"
135113 echo "- \`orb --help\`"
136- echo "- \`open-resource-broker --help\`"
137114 } >> "$GITHUB_STEP_SUMMARY"
138115
139116 generate-sbom :
140117 name : Generate SBOM
141118 runs-on : ubuntu-latest
142119 needs : [get-config, publish]
143- if : github.event_name == 'release' || github.event.inputs.environment == 'pypi'
144120
145121 permissions :
146122 contents : read
0 commit comments