From 286ed463fef31c4ed43488bfd49c1f36568c1167 Mon Sep 17 00:00:00 2001 From: Yuval Bendor Date: Sun, 20 Nov 2022 10:46:46 +0200 Subject: [PATCH 1/2] split publishing step depending on branch --- .circleci/config.yml | 40 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index eeaf20d..e1cbe76 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,7 +1,7 @@ version: 2.1 jobs: - build-and-publish: + test-and-build: docker: - image: cimg/python:3.7.13 steps: @@ -22,13 +22,45 @@ jobs: python3 setup.py bdist_wheel sdist - store_artifacts: path: dist + - persist_to_workspace: + root: . + paths: + - ./dist + + publish-to-test-pypi: + docker: + - image: cimg/python:3.7.13 + steps: + - attach_workspace: + at: . - run: - name: Upload to basic_tests PyPI + name: Upload to PyPI command: | pip install --user twine python3 -m twine upload --skip-existing --verbose --repository testpypi -u ${TESTPYPI_USER} -p ${TESTPYPI_PASSWORD} dist/* + publish-to-production-pypi: + docker: + - image: cimg/python:3.7.13 + steps: + - attach_workspace: + at: . + - run: + name: Upload to PyPI + command: | + pip install --user twine + python3 -m twine upload --skip-existing --verbose -u ${PYPI_USER} -p ${PYPI_PASSWORD} dist/* + workflows: - build-and-publish: + test-build-and-publish: jobs: - - build-and-publish \ No newline at end of file + - test-and-build + - publish-to-test-pypi: + requires: + - test-and-build + - publish-to-production-pypi: + requires: + - test-and-build + filters: + branches: + only: production \ No newline at end of file From cf05fefdb0d2da7d80ea526d31e5d12ee5c32358 Mon Sep 17 00:00:00 2001 From: Yuval Bendor Date: Sun, 20 Nov 2022 11:02:43 +0200 Subject: [PATCH 2/2] use actual pypi envvar --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e1cbe76..37d6dae 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -49,7 +49,7 @@ jobs: name: Upload to PyPI command: | pip install --user twine - python3 -m twine upload --skip-existing --verbose -u ${PYPI_USER} -p ${PYPI_PASSWORD} dist/* + python3 -m twine upload --skip-existing --verbose -u ${PRODPYPI_USER} -p ${PRODPYPI_PASSWORD} dist/* workflows: test-build-and-publish: