Skip to content

Commit

Permalink
testing publishing gha
Browse files Browse the repository at this point in the history
  • Loading branch information
cneyens committed Feb 2, 2025
1 parent fc97fdc commit eead35b
Showing 1 changed file with 42 additions and 23 deletions.
65 changes: 42 additions & 23 deletions .github/workflows/python_publish.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This workflows will upload a Python Package using Twine when a release is created
# For more information see: https://github.com/marketplace/actions/pypi-publish
# This workflows will upload a Python Package when a release is created
# For more information see: https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/#the-whole-ci-cd-workflow

name: gha-pypi-publish

Expand All @@ -8,33 +8,52 @@ on:
types: [created]

jobs:
pypi-publish:
name: Upload release to PyPI
build:
name: Build distribution
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- 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/

publish-to-pypi:
name: Publish PyPI
needs:
- build
runs-on: ubuntu-latest

environment:
name: testpypi # pypi
url: https://test.pypi.org/p/adepy # https://pypi.org/p/adepy

permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
id-token: write # IMPORTANT: mandatory for trusted publishing

steps:
# retrieve your distributions here

- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
- name: Download all the dists
uses: actions/download-artifact@v4
with:
python-version: '3.x'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install wheel twine build
- name: Build package
run: python -m build

- name: Publish package distributions to PyPI
name: python-package-distributions
path: dist/
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
repository-url: https://test.pypi.org/legacy/ # remove for PyPi

0 comments on commit eead35b

Please sign in to comment.