4646 description : " An repository for the extra artifact"
4747 required : false
4848 type : string
49+ pypi_publish :
50+ description : " Whether to publish to PyPI"
51+ required : false
52+ type : boolean
53+ default : false
4954 outputs :
5055 version_tag :
5156 value : ${{ jobs.tag_release.outputs.version_tag }}
5964 NPM_TOKEN :
6065 required : false
6166 description : " NPM token to publish packages"
67+ PYPI_TOKEN :
68+ required : false
69+ description : " PyPI token to publish packages"
6270jobs :
6371 install_semantic_release :
6472 # Install asdf
@@ -231,7 +239,7 @@ jobs:
231239 name : config_artifact
232240
233241 - name : Cache asdf
234- if : inputs.publish_packages != ''
242+ if : ${{ inputs.publish_packages != '' || inputs.pypi_publish }}
235243 uses : actions/cache@v5
236244 with :
237245 path : |
@@ -241,15 +249,15 @@ jobs:
241249 ${{ runner.os }}-asdf-
242250
243251 - name : Install asdf dependencies in .tool-versions
244- if : inputs.publish_packages != ''
252+ if : ${{ inputs.publish_packages != '' || inputs.pypi_publish }}
245253 uses : asdf-vm/actions/install@b7bcd026f18772e44fe1026d729e1611cc435d47
246254 with :
247255 asdf_version : ${{ inputs.asdfVersion }}
248256 env :
249257 PYTHON_CONFIGURE_OPTS : --enable-shared
250258
251259 - name : Install Dependencies and Build Package
252- if : inputs.publish_packages != ''
260+ if : ${{ inputs.publish_packages != '' || inputs.pypi_publish }}
253261 run : |
254262 make install
255263 make build
@@ -320,6 +328,8 @@ jobs:
320328 NPM_TOKEN : ${{ secrets.NPM_TOKEN }}
321329 MAIN_BRANCH : ${{ inputs.main_branch }}
322330 EXTRA_ASSET : ${{ inputs.extra_artifact_name }}
331+ PYPI_PUBLISH : ${{ inputs.pypi_publish }}
332+ PYPI_TOKEN : ${{ secrets.PYPI_TOKEN }}
323333
324334 - name : Create semantic release tag
325335 if : ${{ !inputs.dry_run }}
@@ -330,6 +340,8 @@ jobs:
330340 TAG_FORMAT : ${{ inputs.tag_format }}
331341 MAIN_BRANCH : ${{ inputs.main_branch }}
332342 EXTRA_ASSET : ${{ inputs.extra_artifact_name }}
343+ PYPI_PUBLISH : ${{ inputs.pypi_publish }}
344+ PYPI_TOKEN : ${{ secrets.PYPI_TOKEN }}
333345 run : |
334346 npx semantic-release --tag-format "${TAG_FORMAT}"
335347
0 commit comments