Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 26 additions & 15 deletions .github/workflows/release-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,8 @@
branches: [master]
tags:
- '**'
pull_request:
branches: [master]

workflow_dispatch:

permissions:
contents: read
id-token: write

jobs:
build_sdist:
name: Build source distribution
Expand All @@ -38,50 +31,68 @@
upload_test_pypi:
needs: [build_sdist]
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write
steps:
- name: Install Python (if missing)
run: apt-get update && apt-get install -y python3 python3-pip
run: |
sudo apt-get update
sudo apt-get install -y python3 python3-pip

- name: Update python dependencies
run: python3 -m pip install -U packaging --break-system-packages
run: |
python3 -m venv venv

Check failure on line 45 in .github/workflows/release-python.yml

View workflow job for this annotation

GitHub Actions / checkpatch review

WARNING: Possible repeated word: 'venv'
source venv/bin/activate
pip install -U packaging

- uses: actions/download-artifact@v4
with:
name: artifact
path: dist

- name: Publish package to TestPyPI
env:
PATH: ${{ github.workspace }}/venv/bin:$PATH
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/

upload_pypi:
needs: [build_sdist]
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write
if: startsWith(github.ref, 'refs/tags/v') && github.repository == 'linux-nvme/libnvme'
steps:
- name: Install Python (if missing)
run: apt-get update && apt-get install -y python3 python3-pip
run: |
sudo apt-get update
sudo apt-get install -y python3 python3-pip

- name: Update python dependencies
run: python3 -m pip install -U packaging --break-system-packages
run: |
python3 -m venv venv

Check failure on line 76 in .github/workflows/release-python.yml

View workflow job for this annotation

GitHub Actions / checkpatch review

WARNING: Possible repeated word: 'venv'
source venv/bin/activate
pip install -U packaging

- name: Check if it is a release tag
id: check-tag
run: |
if [[ ${{ github.event.ref }} =~ ^refs/tags/v([0-9]+\.[0-9]+)(\.[0-9]+)?(-rc[0-9]+)?$ ]]; then
echo ::set-output name=match::true
fi

- name: Download artifiact
uses: actions/download-artifact@v4
if: steps.check-tag.outputs.match == 'true'
with:
name: artifact
path: dist

- name: Publish package to PyPI
env:
PATH: ${{ github.workspace }}/venv/bin:$PATH
uses: pypa/gh-action-pypi-publish@release/v1
if: steps.check-tag.outputs.match == 'true'
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
verify-metadata: false