1- name : Python CD
1+ name : Python SDK CD
22on :
33 push :
44 branches : [develop]
55 release :
66 types : [published]
77 workflow_dispatch :
88
9- env :
10- DIST_DIR : dist/
9+ concurrency :
10+ group : ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
11+ cancel-in-progress : false
12+
13+ permissions : {}
1114
1215jobs :
1316 build-distributables :
17+ name : Build release distributables
1418 # Why building is separate from publishing:
1519 # https://github.com/pypa/gh-action-pypi-publish/issues/217#issuecomment-1965727093
1620 runs-on : ubuntu-latest
@@ -26,15 +30,17 @@ jobs:
2630 deps-group : release
2731 - name : Set pre-release version
2832 if : startsWith(github.ref, 'refs/tags/') != true
33+ env :
34+ RUN_NUMBER : ${{ github.run_number }}
2935 run : |
3036 VERSION_BASE="$(uv version --short)"
31- RUN_NUMBER="${{ github.run_number }}"
3237 uv version "${VERSION_BASE}.dev${RUN_NUMBER}"
3338 - name : Set release version
3439 if : startsWith(github.ref, 'refs/tags/') == true
40+ env :
41+ VERSION_TAG : ${{ github.event.release.tag_name }}
3542 run : |
36- VERSION_TAG="${{ github.event.release.tag_name }}"
37- [[ $VERSION_TAG != $(uv version --short) ]] && {
43+ [[ ${VERSION_TAG} != $(uv version --short) ]] && {
3844 printf "Git tag should be identical to version field in pyproject.toml"
3945 exit 1
4046 }
5056 uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
5157 with :
5258 name : splunk-sdk-${{ steps.get-version.outputs.version }}
53- path : ${{ env.DIST_DIR }}
59+ path : dist/
5460 - name : Generate API reference
5561 run : make -C ./docs zip
5662 - name : Upload docs artifact
@@ -60,11 +66,12 @@ jobs:
6066 path : docs/_build/splunk-sdk-python-docs.zip
6167
6268 publish-pre-release :
69+ name : Publish pre-release to Test PyPI
6370 if : startsWith(github.ref, 'refs/tags/') == false
6471 needs : build-distributables
6572 runs-on : ubuntu-latest
6673 permissions :
67- id-token : write
74+ id-token : write # Required for OIDC-based trusted publishing to PyPI
6875 environment :
6976 name : splunk-test-pypi
7077 url : https://test.pypi.org/project/splunk-sdk/
@@ -73,18 +80,19 @@ jobs:
7380 uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
7481 with :
7582 name : splunk-sdk-${{ needs.build-distributables.outputs.version }}
76- path : ${{ env.DIST_DIR }}
83+ path : dist/
7784 - name : Publish packages to Test PyPI
7885 uses : pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b
7986 with :
8087 repository-url : https://test.pypi.org/legacy/
8188
8289 publish-release :
90+ name : Publish release to PyPI
8391 if : startsWith(github.ref, 'refs/tags/') == true
8492 needs : build-distributables
8593 runs-on : ubuntu-latest
8694 permissions :
87- id-token : write
95+ id-token : write # Required for OIDC-based trusted publishing to PyPI
8896 environment :
8997 name : splunk-pypi
9098 url : https://pypi.org/project/splunk-sdk/
93101 uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
94102 with :
95103 name : splunk-sdk-${{ needs.build-distributables.outputs.version }}
96- path : ${{ env.DIST_DIR }}
104+ path : dist/
97105 - name : Publish packages to PyPI
98106 uses : pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b
99107 with :
0 commit comments