diff --git a/jobs/templates/swh-pipeline.yaml b/jobs/templates/swh-pipeline.yaml --- a/jobs/templates/swh-pipeline.yaml +++ b/jobs/templates/swh-pipeline.yaml @@ -23,8 +23,13 @@ description: | PYPI registry to publish to when built revision is a tag. There must exists a usernamePassword credential object with that name. - The publication endpoint is built as https://$PYPI/legagy/ + The pypi JSON API endpoint is built as https://$PYPI/project//json default: test.pypi.org + - string: + name: PYPI_UPLOAD + description: | + PYPI upload base host. If unset, defaults to $PYPI. The upload endpoint is built as + https://$PYPI_UPLOAD/legagy/ - bool: name: FORCE_UPLOAD default: false @@ -126,7 +131,7 @@ GITTAG=sh(returnStdout: true, script:'git describe --exact-match 2>/dev/null || true').trim() LASTV=sh(returnStdout: true, - script:'curl -s https://${{params.PYPI}}/pypi/`python setup.py --name`/json | jq -r .info.version || true').trim() + script:'curl -s https://${{PYPI}}/pypi/`python setup.py --name`/json | jq -r .info.version || true').trim() return ! (GITTAG in ['', 'v'+LASTV]) }} }} @@ -136,7 +141,10 @@ usernamePassword(credentialsId: "${{params.PYPI}}", usernameVariable: 'TWINE_USERNAME', passwordVariable: 'TWINE_PASSWORD')]) {{ - sh 'python3 -m twine upload --repository-url https://${{PYPI}}/legacy/ dist/*' + sh ''' + if [ -z "$PYPI_UPLOAD" ]; then PYPI_UPLOAD=$PYPI; fi + python3 -m twine upload --repository-url https://${{PYPI_UPLOAD}}/legacy/ dist/* + ''' }} }} }}