Skip to content

Commit

Permalink
Update publish.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
AmelieJB authored Nov 3, 2024
1 parent 23cdd62 commit 71fcf5a
Showing 1 changed file with 43 additions and 27 deletions.
70 changes: 43 additions & 27 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,52 @@
name: Upload Python Package to TestPyPI
name: Publish Python distribution to TestPyPI

on: push

on:
push:
branches:
- main

jobs:
publish-to-testpypi:
build:
name: Build distribution
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x' # Passe die Python-Version an
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install pypa/build
run: >-
python3 -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: python3 -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
publish-to-testpypi:
name: Publish Python distribution to TestPyPI
needs:
- build
runs-on: ubuntu-latest

- name: Build package
run: |
python setup.py sdist bdist_wheel
environment:
name: testpypi
url: https://test.pypi.org/p/<package-name>

- name: Publish to TestPyPI
env:
TWINE_USERNAME: ${{ secrets.TEST_PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_PASSWORD }}
run: |
twine upload --repository-url https://test.pypi.org/legacy/ dist/*
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing

steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/

0 comments on commit 71fcf5a

Please sign in to comment.