66 branches : [master]
77 tags :
88 - ' **'
9- pull_request :
10- branches : [master]
11-
129 workflow_dispatch :
1310
14- permissions :
15- contents : read
16- id-token : write
17-
1811jobs :
1912 build_sdist :
2013 name : Build source distribution
@@ -38,50 +31,68 @@ jobs:
3831 upload_test_pypi :
3932 needs : [build_sdist]
4033 runs-on : ubuntu-latest
34+ environment : pypi
35+ permissions :
36+ id-token : write
4137 steps :
4238 - name : Install Python (if missing)
43- run : apt-get update && apt-get install -y python3 python3-pip
39+ run : |
40+ sudo apt-get update
41+ sudo apt-get install -y python3 python3-pip
4442
4543 - name : Update python dependencies
46- run : python3 -m pip install -U packaging --break-system-packages
44+ run : |
45+ python3 -m venv venv
46+ source venv/bin/activate
47+ pip install -U packaging
4748
4849 - uses : actions/download-artifact@v4
4950 with :
5051 name : artifact
5152 path : dist
5253
5354 - name : Publish package to TestPyPI
55+ env :
56+ PATH : ${{ github.workspace }}/venv/bin:$PATH
5457 uses : pypa/gh-action-pypi-publish@release/v1
5558 with :
5659 repository-url : https://test.pypi.org/legacy/
5760
5861 upload_pypi :
5962 needs : [build_sdist]
6063 runs-on : ubuntu-latest
64+ environment : pypi
65+ permissions :
66+ id-token : write
6167 if : startsWith(github.ref, 'refs/tags/v') && github.repository == 'linux-nvme/libnvme'
6268 steps :
6369 - name : Install Python (if missing)
64- run : apt-get update && apt-get install -y python3 python3-pip
70+ run : |
71+ sudo apt-get update
72+ sudo apt-get install -y python3 python3-pip
6573
6674 - name : Update python dependencies
67- run : python3 -m pip install -U packaging --break-system-packages
75+ run : |
76+ python3 -m venv venv
77+ source venv/bin/activate
78+ pip install -U packaging
6879
6980 - name : Check if it is a release tag
7081 id : check-tag
7182 run : |
7283 if [[ ${{ github.event.ref }} =~ ^refs/tags/v([0-9]+\.[0-9]+)(\.[0-9]+)?(-rc[0-9]+)?$ ]]; then
7384 echo ::set-output name=match::true
7485 fi
86+
7587 - name : Download artifiact
7688 uses : actions/download-artifact@v4
7789 if : steps.check-tag.outputs.match == 'true'
7890 with :
7991 name : artifact
8092 path : dist
93+
8194 - name : Publish package to PyPI
95+ env :
96+ PATH : ${{ github.workspace }}/venv/bin:$PATH
8297 uses : pypa/gh-action-pypi-publish@release/v1
8398 if : steps.check-tag.outputs.match == 'true'
84- with :
85- user : __token__
86- password : ${{ secrets.PYPI_API_TOKEN }}
87- verify-metadata : false
0 commit comments