Closed emmeowzing closed 1 year ago
For context / reproducing, I've created a job in my CI config
release-twine-setup-py:
description: twine upload
docker:
- image: my-registry/python-3-10:v1.0.1
auth:
username: $DOCKER_USERNAME
password: $DOCKER_PASSWORD
resource_class: << parameters.resource-class >>
environment:
TWINE_NON_INTERACTIVE: true
parameters:
resource-class:
type: enum
enum:
- small
- medium
- large
- xlarge
- 2xlarge
default: small
description: Resource class to run as.
user:
description: PyPi username.
type: string
default: $TWINE_USERNAME
password:
description: PyPi API token.
type: string
default: $TWINE_PASSWORD
repository:
description: Repository name to upload to. Must have a URL set in .pypirc.
type: string
default: python
config:
description: Location of the .pypirc-file to use.
type: string
default: .pypirc
version:
description: Override the version of the uploaded artifact in pyproject.toml. Mainly for development pipelines.
type: integer
default: -1
steps:
- checkout
- install-poetry
- unless:
condition:
equal: [<< parameters.version >>, -1]
steps:
- run:
name: Update pyproject.toml version
command: |
_VERSION="$(grep -oiP "(?<=version = \").*(?=\")" pyproject.toml)"
if [[ "$_VERSION" =~ ^[0-9]+.[0-9]+.[0-9]+$ ]]; then
sed "s@version = \"${_VERSION}\"@version = \"0.0.<< parameters.version >>\"@" pyproject.toml > pyproject.toml.tmp
elif [[ "$_VERSION" =~ ^[0-9]+.[0-9]+.[0-9]+a[0-9]+$ ]]; then
_VERSION_A="${_VERSION%%a*}"
sed "s@version = \"${_VERSION}\"@version = \"0.0.<< parameters.version >>\"@" pyproject.toml > pyproject.toml.tmp
fi
mv pyproject.toml.tmp pyproject.toml
# - run:
# name: Update setup.py version
# command: |
# _VERSION="$(grep -oiP "(?<=version=\').*(?=\',)" setup.py)"
# if [[ "$_VERSION" =~ ^[0-9]+.[0-9]+.[0-9]+$ ]]; then
# sed "s@version=\'${_VERSION}\'@version=\'0.0.<< parameters.version >>\'@" setup.py > setup.py.tmp
# elif [[ "$_VERSION" =~ ^[0-9]+.[0-9]+.[0-9]+a[0-9]+$ ]]; then
# _VERSION_A="${_VERSION%%a*}"
# sed "s@version=\'${_VERSION}\'@version=\'0.0.<< parameters.version >>\'@" setup.py > setup.py.tmp
# fi
# mv setup.py.tmp setup.py
- run:
name: Build package
command: |
poetry build
- run:
name: Publish package to PyPI
command: |
pip install twine
twine upload dist/* -u << parameters.user >> -p << parameters.password >> --repository << parameters.repository >> --non-interactive --config-file << parameters.config >>
and I call it in my workflow like
- release-twine-setup-py:
name: twine upload [python-develop]
context: nexus
repository: python-develop
version: << pipeline.number >>
requires:
- pylint [python-develop]
filters:
branches:
ignore:
- master
and from what I see in the docs (https://circleci.com/docs/pipeline-variables/), << pipeline.number >>
is of type integer
. Plus, it worked on version 0.1.23845, but breaks in version 0.1.25569.
Meta:
CircleCI CLI Version:
0.1.25569
Operating System:
cimg/python:3.10.9
CircleCI CLI Diagnostic:
Current behavior:
Also here: https://app.circleci.com/pipelines/github/premiscale/premiscale/511/workflows/083fe6b8-0039-46bb-bb70-caeb8edcf371/jobs/2592?invite=true#step-107-5
Expected behavior:
Should be the same as the previous version, I think? So
When did this begin / Was this previously working?:
It worked on version
0.1.23845
, now it's broken on version0.1.25569
following runningcircleci update install
.Additional Information: N/A