Skip to content

Commit 1a8dd9d

Browse files
committed
build: fix python upload workflows
Use virtual python environment to install the packaging tool. Signed-off-by: Daniel Wagner <[email protected]>
1 parent 2b30489 commit 1a8dd9d

1 file changed

Lines changed: 22 additions & 5 deletions

File tree

.github/workflows/release-python.yml

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,19 +40,28 @@ jobs:
4040
runs-on: ubuntu-latest
4141
steps:
4242
- name: Install Python (if missing)
43-
run: apt-get update && apt-get install -y python3 python3-pip
43+
run: |
44+
sudo apt-get update
45+
sudo apt-get install -y python3 python3-pip
4446
4547
- name: Update python dependencies
46-
run: python3 -m pip install -U packaging --break-system-packages
48+
run: |
49+
python3 -m venv venv
50+
source venv/bin/activate
51+
pip install -U packaging
4752
4853
- uses: actions/download-artifact@v4
4954
with:
5055
name: artifact
5156
path: dist
5257

5358
- name: Publish package to TestPyPI
59+
env:
60+
PATH: ${{ github.workspace }}/venv/bin:$PATH
5461
uses: pypa/gh-action-pypi-publish@release/v1
5562
with:
63+
user: __token__
64+
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
5665
repository-url: https://test.pypi.org/legacy/
5766

5867
upload_pypi:
@@ -61,27 +70,35 @@ jobs:
6170
if: startsWith(github.ref, 'refs/tags/v') && github.repository == 'linux-nvme/libnvme'
6271
steps:
6372
- name: Install Python (if missing)
64-
run: apt-get update && apt-get install -y python3 python3-pip
73+
run: |
74+
sudo apt-get update
75+
sudo apt-get install -y python3 python3-pip
6576
6677
- name: Update python dependencies
67-
run: python3 -m pip install -U packaging --break-system-packages
78+
run: |
79+
python3 -m venv venv
80+
source venv/bin/activate
81+
pip install -U packaging
6882
6983
- name: Check if it is a release tag
7084
id: check-tag
7185
run: |
7286
if [[ ${{ github.event.ref }} =~ ^refs/tags/v([0-9]+\.[0-9]+)(\.[0-9]+)?(-rc[0-9]+)?$ ]]; then
7387
echo ::set-output name=match::true
7488
fi
89+
7590
- name: Download artifiact
7691
uses: actions/download-artifact@v4
7792
if: steps.check-tag.outputs.match == 'true'
7893
with:
7994
name: artifact
8095
path: dist
96+
8197
- name: Publish package to PyPI
98+
env:
99+
PATH: ${{ github.workspace }}/venv/bin:$PATH
82100
uses: pypa/gh-action-pypi-publish@release/v1
83101
if: steps.check-tag.outputs.match == 'true'
84102
with:
85103
user: __token__
86104
password: ${{ secrets.PYPI_API_TOKEN }}
87-
verify-metadata: false

0 commit comments

Comments
 (0)