Skip to content

Commit

Permalink
fixing pypi publish
Browse files Browse the repository at this point in the history
  • Loading branch information
ralequi committed Nov 18, 2024
1 parent ccc9dae commit a6da931
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 8 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Publish to PyPI
on: push
jobs:
build-n-publish:
name: Build and publish Python 🐍 distributions πŸ“¦ to PyPI
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags') || github.ref == 'refs/heads/main'
permissions:
id-token: write
steps:
- name: Checkout code
uses: actions/checkout@master
with:
fetch-depth: 0

- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Install pypa/build
run: |
pip install build --user
pip install .
- name: Install pypa/pdoc
run: >-
python -m
pip install
.[dev]
--user
- name: Generate documentation with pdoc
run: python -m pdoc -o docs -n pysmart_exporter

- name: Build the binary wheel and source tarball
run: python -m build --sdist --wheel --outdir dist/

- name: Publish distribution πŸ“¦ to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true
10 changes: 2 additions & 8 deletions .github/workflows/publish-to-test-pypi.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Publish Python 🐍 distributions πŸ“¦ to PyPI and TestPyPI
name: Publish to TestPyPI
on: push
jobs:
build-n-publish:
name: Build and publish Python 🐍 distributions πŸ“¦ to PyPI and TestPyPI
name: Build and publish Python 🐍 distributions πŸ“¦ to TestPyPI
runs-on: ubuntu-latest
permissions:
id-token: write
Expand Down Expand Up @@ -38,9 +38,3 @@ jobs:
with:
repository-url: https://test.pypi.org/legacy/
skip-existing: true

- name: Publish distribution πŸ“¦ to PyPI
if: startsWith(github.ref, 'refs/tags') || github.ref == 'refs/heads/master'
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}

0 comments on commit a6da931

Please sign in to comment.