File tree Expand file tree Collapse file tree 10 files changed +101
-8
lines changed
Expand file tree Collapse file tree 10 files changed +101
-8
lines changed Original file line number Diff line number Diff line change 1+ Hello
Original file line number Diff line number Diff line change 1+ from setuptools import setup
2+
3+ setup (
4+ name = 'simplepkg' ,
5+ version = '0.0.1' ,
6+ license = 'MIT' ,
7+ long_description = "README.txt" ,
8+ packages = ['simplepkg' ],
9+ include_package_data = True ,
10+ description = "Simple Package" ,
11+ )
Original file line number Diff line number Diff line change 1+
2+ class Hello (object ):
3+ def say_hello (self ):
4+ return "Hello, World!"
Original file line number Diff line number Diff line change 7373 fi
7474 echo "All tests passed."
7575
76+ test-upload_python_package :
77+ docker :
78+ - image : cimg/python:3.9
79+ steps :
80+ - checkout
81+ - run :
82+ name : Prepare distribution
83+ command : python setup.py sdist
84+ working_directory : .circleci/simplepkg-py
85+ - cloudsmith-circleci/upload_python_package :
86+ repository : " circleci-orb-testing"
87+ service_account : " circleci-orb-testing"
88+ package_path : .circleci/simplepkg-py/dist/simplepkg-0.0.1.tar.gz
7689
7790workflows :
7891 test-deploy :
@@ -85,6 +98,9 @@ workflows:
8598 - test-set_env_vars_for_pip :
8699 context : circleci-orb-publishing
87100 filters : *filters
101+ - test-upload_python_package :
102+ context : circleci-orb-publishing
103+ filters : *filters
88104 # The orb must be re-packed for publishing, and saved to the workspace.
89105 - orb-tools/pack :
90106 filters : *release-filters
@@ -97,6 +113,7 @@ workflows:
97113 - orb-tools/pack
98114 - test-authenticate_with_oidc
99115 - test-set_env_vars_for_pip
116+ - test-upload_python_package
100117 # Use a context to hold your publishing token.
101118 context : circleci-orb-publishing
102119 filters : *release-filters
Original file line number Diff line number Diff line change 22orb.yml
33.DS_Store
44.idea
5+
6+ .circleci /simplepkg-py /dist
7+ .circleci /simplepkg-py /simplepkg.egg-info
Original file line number Diff line number Diff line change @@ -9,16 +9,13 @@ parameters:
99 type : string
1010steps :
1111 - run :
12- name : Configure Cloudsmith organisation
12+ name : Cloudsmith - Configure organisation and service account
1313 command : |
1414 if [ -z "$CLOUDSMITH_ORGANISATION" ]
1515 then
1616 echo "export CLOUDSMITH_ORGANISATION=\"financial-times\"" >> "$BASH_ENV"
1717 fi
18- - run :
19- name : Configure Cloudsmith service account
20- command : |
2118 echo "export CLOUDSMITH_SERVICE_ACCOUNT=\"<<parameters.service_account>>\"" >> "$BASH_ENV"
2219 - run :
23- name : Authenticate with OIDC
20+ name : Cloudsmith - Authenticate with OIDC
2421 command : <<include(scripts/authenticate_with_oidc.sh)>>
Original file line number Diff line number Diff line change @@ -11,13 +11,13 @@ steps:
1111 - authenticate_with_oidc :
1212 service_account : <<parameters.service_account>>
1313 - run :
14- name : Configure Cloudsmith domains
14+ name : Cloudsmith - Configure domains
1515 command : <<include(scripts/configure_cloudsmith_domains.sh)>>
1616 - run :
17- name : Configure Cloudsmith repository
17+ name : Cloudsmith - Configure repository
1818 command : |
1919 echo "export CLOUDSMITH_REPOSITORY=\"<<parameters.repository>>\"" >> $BASH_ENV
2020 echo "CLOUDSMITH_REPOSITORY=<<parameters.repository>>"
2121 - run :
22- name : Set environment variables for pip
22+ name : Cloudsmith - Set CLOUDSMITH_PIP_INDEX_URL environment variable
2323 command : <<include(scripts/set_env_vars_for_pip.sh)>>
Original file line number Diff line number Diff line change 1+ description :
2+ Upload a python package to a Cloudsmith repository using the Cloudsmith CLI
3+ parameters :
4+ repository :
5+ description : The identity/slug of the Cloudsmith repository
6+ type : string
7+ service_account :
8+ description : The identity/slug of the Cloudsmith service account to use when authenticating
9+ type : string
10+ package_path :
11+ description : The location of the package files to upload
12+ type : string
13+ steps :
14+ - run :
15+ name : Cloudsmith - Install CLI
16+ command : |
17+ python -m ensurepip --upgrade
18+
19+ echo ""
20+ echo "Installing cloudsmith-cli using pip ..."
21+
22+ python -m pip install cloudsmith-cli==1.1.1 --upgrade --user --extra-index-url=https://dl.cloudsmith.io/public/cloudsmith/cli/python/index/
23+
24+ echo ""
25+ echo "Cloudsmith CLI installed OK."
26+
27+ cloudsmith --version
28+ - authenticate_with_oidc :
29+ service_account : <<parameters.service_account>>
30+ - run :
31+ name : Cloudsmith - Upload package
32+ command : |
33+ echo ""
34+ echo "Uploading package <<parameters.package_path>> to Cloudsmith repository $CLOUDSMITH_ORGANISATION/<<parameters.repository>> ..."
35+
36+ cloudsmith push python --verbose --api-key "$CLOUDSMITH_OIDC_TOKEN" "$CLOUDSMITH_ORGANISATION/<<parameters.repository>>" "<<parameters.package_path>>"
37+
38+ echo ""
39+ echo "Package upload and synchronisation completed OK."
Original file line number Diff line number Diff line change 1+ description : >
2+ Upload a python package to Cloudsmith.
3+ usage :
4+ version : 2.1
5+ orbs :
6+ ft-cloudsmith :
ft-circleci-orbs/[email protected] 7+ jobs :
8+ build :
9+ docker :
10+ - image : cimg/python:3.9
11+ steps :
12+ - checkout
13+ - run : python setup.py bdist_wheel --universal
14+ - ft-cloudsmith/upload_python_package :
15+ repository : " your-repository-id"
16+ service_account : " your-service-account"
17+ package_path : dist/your-package-0.0.1.tar.gz
18+ workflows :
19+ main :
20+ jobs :
21+ - build
You can’t perform that action at this time.
0 commit comments