1- name : Publish Keeper SDK to PyPi
1+ name : Publish Keeper SDK to PyPI
22
33on : [workflow_dispatch]
44
55jobs :
6- build-wheel :
7- name : Build and publish Keeper SDK for Python 📦 to PyPI
6+ build-and-test :
7+ name : Build and test Keeper SDK package
88 runs-on : ubuntu-latest
9- timeout-minutes : 25 # To keep builds from running too long
9+ timeout-minutes : 25
1010
1111 steps :
1212 - name : Checkout source code
13- uses : actions/checkout@v2
13+ uses : actions/checkout@v4
1414
15- - name : Set up Python 3.11
16- uses : actions/setup-python@v4
15+ - name : Set up Python 3.13
16+ uses : actions/setup-python@v5
1717 with :
18- python-version : ' 3.11'
18+ python-version : ' 3.13'
19+
20+ - name : Install dependencies
21+ run : |
22+ pip install keepersdk-package/
23+
24+ - name : Run unit tests
25+ run : python -m unittest discover -s keepersdk-package/unit_tests/
1926
2027 - name : Build the package
2128 run : |
22- python3 -m pip install -U setuptools build wheel twine
29+ python3 -m pip install -U build wheel twine
2330 python3 -m build --wheel keepersdk-package
2431
2532 - name : Archive the package
26- uses : actions/upload-artifact@v3
33+ uses : actions/upload-artifact@v4
2734 with :
2835 name : KeeperSdkWheel
2936 retention-days : 1
3037 path : keepersdk-package/dist/*
3138 if-no-files-found : error
3239
33- - name : Publish Commander to test PyPi
40+ publish-test-pypi :
41+ name : Publish to Test PyPI
42+ runs-on : ubuntu-latest
43+ needs : [build-and-test]
44+ environment : test
45+
46+ steps :
47+ - uses : actions/download-artifact@v4
48+ with :
49+ name : KeeperSdkWheel
50+ path : keepersdk-package/dist
51+
52+ - name : Set up Python 3.13
53+ uses : actions/setup-python@v5
54+ with :
55+ python-version : ' 3.13'
56+
57+ - name : Publish to Test PyPI
3458 env :
3559 TWINE_USERNAME : __token__
3660 TWINE_PASSWORD : ${{ secrets.TEST_PYPI_TOKEN }}
3761 run : |
38- twine upload -r testpypi dist/*
39-
62+ python -m pip install -U twine
63+ twine upload --repository testpypi keepersdk-package/dist/*
4064
4165 publish-pypi :
42- name : Publish Keeper SDK to PyPi
66+ name : Publish to Production PyPI
4367 runs-on : ubuntu-latest
44- needs : [build-wheel ]
68+ needs : [publish-test-pypi ]
4569 environment : prod
4670
4771 steps :
48- - uses : actions/download-artifact@v3
72+ - uses : actions/download-artifact@v4
4973 with :
50- name : CommanderWheel
51- path : dist
52-
53- - name : Set up Python 3.10
54- uses : actions/setup-python@v4
55- with :
56- python-version : ' 3.11'
74+ name : KeeperSdkWheel
75+ path : keepersdk-package/dist
5776
58- - name : Retrieve secrets from Keeper
59- id : ksecrets
60- uses : Keeper-Security/ksm-action@master
77+ - name : Set up Python 3.13
78+ uses : actions/setup-python@v5
6179 with :
62- keeper-secret-config : ${{ secrets.KSM_COMMANDER_SECRET_CONFIG }}
63- secrets : |
64- gD5LOOhI5QbnSFk8mIg3gg/field/password > PYPI_PASSWORD
80+ python-version : ' 3.13'
6581
66- - name : Publish to PyPi
82+ - name : Publish to PyPI
6783 env :
6884 TWINE_USERNAME : __token__
69- TWINE_PASSWORD : ${{ steps.ksecrets.outputs.PYPI_PASSWORD }}
85+ TWINE_PASSWORD : ${{ secrets.PYPI_PUBLISH_TOKEN }}
7086 run : |
71- python -m pip install -U setuptools pip wheel twine
72- twine upload dist/*
87+ python -m pip install -U twine
88+ twine upload keepersdk-package/ dist/*
0 commit comments