Skip to content

Commit

Permalink
Modernize pypi action
Browse files Browse the repository at this point in the history
Change format to yaml
Run it on pull requests to check all steps work
Publish conditionally only on tag ref pushes

Signed-off-by: Simo Sorce <simo@redhat.com>
  • Loading branch information
simo5 committed Mar 5, 2024
1 parent 491f448 commit bb62f1c
Showing 1 changed file with 36 additions and 36 deletions.
72 changes: 36 additions & 36 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
{
"name": "Release to PyPI",
"on": {
"push": {
"tags": [ "v*.*" ]
},
},
"jobs": {
"pypi": {
"name": "Publish Release",
"runs-on": "ubuntu-latest",
"steps": [
{ "uses": "actions/checkout@v2" },
{
"uses": "actions/setup-python@v2",
"with": {
"python-version": "3.10"
},
},
{ "run": "sudo apt-get update" },
{ "run": "sudo apt-get install cargo" },
{ "run": "pip --version" },
{ "run": "python setup.py sdist" },
{ "run": "python setup.py bdist_wheel" },
{
"uses": "pypa/gh-action-pypi-publish@release/v1",
"with": {
"user": "__token__",
"password": "${{secrets.PYPI_API_TOKEN}}",
"skip-existing": true,
},
},
],
},
},
}
---
name: Release to PyPI

on:
push:
tags: [ "v*.*" ]
pull_request:
branches: ["main"]

jobs:
pypi:
name: Publish Release
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup
uses: actions/setup-python@v5
with:
python-version: 3.10
- name: Make distribution
run: |
sudo apt-get update
sudo apt-get install cargo python-wheel-common
pip --version
python setup.py sdist
python setup.py bdist_wheel
- name: Publish on pypi (only for tag pushes)
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{secrets.PYPI_API_TOKEN}}
skip-existing: true

0 comments on commit bb62f1c

Please sign in to comment.