1- name : Publish Keeper SDK to PyPi
2-
3- on : [workflow_dispatch]
1+ name : Publish Keeper SDK to PyPI
42
3+ on :
4+ workflow_dispatch :
5+ inputs :
6+ version :
7+ description : Version to release (tag or branch)
8+ required : true
59jobs :
6- build-wheel :
7- name : Build and publish Keeper SDK for Python 📦 to PyPI
10+ build-and-test :
11+ name : Build and test Keeper SDK package
812 runs-on : ubuntu-latest
9- timeout-minutes : 25 # To keep builds from running too long
13+ timeout-minutes : 25
14+ permissions :
15+ contents : read
1016
1117 steps :
1218 - name : Checkout source code
13- uses : actions/checkout@v2
19+ uses : actions/checkout@v4
20+ with :
21+ ref : ${{ github.event.inputs.version }}
1422
15- - name : Set up Python 3.11
16- uses : actions/setup-python@v4
23+ - name : Set up Python 3.13
24+ uses : actions/setup-python@v5
1725 with :
18- python-version : ' 3.11'
26+ python-version : ' 3.13'
27+
28+ - name : Install dependencies
29+ run : |
30+ pip install keepersdk-package/
31+
32+ - name : Run unit tests
33+ run : python -m unittest discover -s keepersdk-package/unit_tests/
1934
2035 - name : Build the package
2136 run : |
22- python3 -m pip install -U setuptools build wheel twine
37+ python3 -m pip install -U build wheel twine
2338 python3 -m build --wheel keepersdk-package
2439
2540 - name : Archive the package
26- uses : actions/upload-artifact@v3
41+ uses : actions/upload-artifact@v4
2742 with :
2843 name : KeeperSdkWheel
2944 retention-days : 1
3045 path : keepersdk-package/dist/*
3146 if-no-files-found : error
3247
33- - name : Publish Commander to test PyPi
48+ publish-test-pypi :
49+ name : Publish to Test PyPI
50+ runs-on : ubuntu-latest
51+ needs : [build-and-test]
52+ environment : test
53+
54+ steps :
55+ - uses : actions/download-artifact@v4
56+ with :
57+ name : KeeperSdkWheel
58+ path : keepersdk-package/dist
59+
60+ - name : Set up Python 3.13
61+ uses : actions/setup-python@v5
62+ with :
63+ python-version : ' 3.13'
64+
65+ - name : Publish to Test PyPI
3466 env :
3567 TWINE_USERNAME : __token__
3668 TWINE_PASSWORD : ${{ secrets.TEST_PYPI_TOKEN }}
3769 run : |
38- twine upload -r testpypi dist/*
39-
70+ python -m pip install -U twine
71+ twine upload --repository testpypi keepersdk-package/dist/*
4072
4173 publish-pypi :
42- name : Publish Keeper SDK to PyPi
74+ name : Publish to Production PyPI
4375 runs-on : ubuntu-latest
44- needs : [build-wheel ]
76+ needs : [publish-test-pypi ]
4577 environment : prod
4678
4779 steps :
48- - uses : actions/download-artifact@v3
49- with :
50- name : CommanderWheel
51- path : dist
52-
53- - name : Set up Python 3.10
54- uses : actions/setup-python@v4
80+ - uses : actions/download-artifact@v4
5581 with :
56- python-version : ' 3.11'
82+ name : KeeperSdkWheel
83+ path : keepersdk-package/dist
5784
58- - name : Retrieve secrets from Keeper
59- id : ksecrets
60- uses : Keeper-Security/ksm-action@master
85+ - name : Set up Python 3.13
86+ uses : actions/setup-python@v5
6187 with :
62- keeper-secret-config : ${{ secrets.KSM_COMMANDER_SECRET_CONFIG }}
63- secrets : |
64- gD5LOOhI5QbnSFk8mIg3gg/field/password > PYPI_PASSWORD
88+ python-version : ' 3.13'
6589
66- - name : Publish to PyPi
90+ - name : Publish to PyPI
6791 env :
6892 TWINE_USERNAME : __token__
69- TWINE_PASSWORD : ${{ steps.ksecrets.outputs.PYPI_PASSWORD }}
93+ TWINE_PASSWORD : ${{ secrets.PYPI_PUBLISH_TOKEN }}
7094 run : |
71- python -m pip install -U setuptools pip wheel twine
72- twine upload dist/*
95+ python -m pip install -U twine
96+ twine upload keepersdk-package/ dist/*
0 commit comments