Skip to content

Commit 2361266

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 2361266

1 file changed

Lines changed: 20 additions & 4 deletions

File tree

.github/workflows/release-python.yml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,24 @@ 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:
5663
repository-url: https://test.pypi.org/legacy/
@@ -61,24 +68,33 @@ jobs:
6168
if: startsWith(github.ref, 'refs/tags/v') && github.repository == 'linux-nvme/libnvme'
6269
steps:
6370
- name: Install Python (if missing)
64-
run: apt-get update && apt-get install -y python3 python3-pip
71+
run: |
72+
sudo apt-get update
73+
sudo apt-get install -y python3 python3-pip
6574
6675
- name: Update python dependencies
67-
run: python3 -m pip install -U packaging --break-system-packages
76+
run: |
77+
python3 -m venv venv
78+
source venv/bin/activate
79+
pip install -U packaging
6880
6981
- name: Check if it is a release tag
7082
id: check-tag
7183
run: |
7284
if [[ ${{ github.event.ref }} =~ ^refs/tags/v([0-9]+\.[0-9]+)(\.[0-9]+)?(-rc[0-9]+)?$ ]]; then
7385
echo ::set-output name=match::true
7486
fi
87+
7588
- name: Download artifiact
7689
uses: actions/download-artifact@v4
7790
if: steps.check-tag.outputs.match == 'true'
7891
with:
7992
name: artifact
8093
path: dist
94+
8195
- name: Publish package to PyPI
96+
env:
97+
PATH: ${{ github.workspace }}/venv/bin:$PATH
8298
uses: pypa/gh-action-pypi-publish@release/v1
8399
if: steps.check-tag.outputs.match == 'true'
84100
with:

0 commit comments

Comments
 (0)