From 24890db26517a4ced15994b53559eef048676ade Mon Sep 17 00:00:00 2001 From: rlskoeser Date: Tue, 8 Oct 2024 16:16:22 -0400 Subject: [PATCH 1/2] Update python package publishing workflow with newer logic --- .github/workflows/python-publish.yml | 46 ++++++++++++++++++---------- 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 4e1ef42..3afb57a 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -1,31 +1,45 @@ -# This workflows will upload a Python Package using Twine when a release is created -# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries +# This workflow will upload a Python Package when a release is created +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries + +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. name: Upload Python Package on: + # normal behavior: run when a new release is created release: - types: [created] + types: [published] + # allow running manually on main + workflow_dispatch: + branches: [main] -jobs: - deploy: +permissions: + contents: read +jobs: + pypi-publish: + name: Upload release to PyPI runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/project/pucas/ + permissions: + id-token: write # IMPORTANT: this permission is mandatory for trusted publishing steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: - python-version: '3.x' + python-version: '3.11' - name: Install dependencies run: | python -m pip install --upgrade pip - pip install setuptools wheel twine - - name: Build and publish - env: - TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} - TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} - run: | - python setup.py sdist bdist_wheel - twine upload dist/* + pip install build + - name: Build package + run: python -m build + - name: Publish package + uses: pypa/gh-action-pypi-publish@release/v1 From be7378fc446859439d94690bbad08689f4237ed0 Mon Sep 17 00:00:00 2001 From: rlskoeser Date: Tue, 8 Oct 2024 16:20:41 -0400 Subject: [PATCH 2/2] Document v0.9.1 workflow change --- CHANGELOG.rst | 5 +++++ pucas/__init__.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 1199693..0dc9a83 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,11 @@ CHANGELOG ========= +0.9.1 +----- + +* Update GitHub Actions for publishing releases to PyPI + 0.9 --- diff --git a/pucas/__init__.py b/pucas/__init__.py index a631899..976272e 100644 --- a/pucas/__init__.py +++ b/pucas/__init__.py @@ -1,4 +1,4 @@ -__version_info__ = (0, 9, 0, None) +__version_info__ = (0, 9, 1, None) # Dot-connect all but the last. Last is dash-connected if not None. __version__ = ".".join([str(i) for i in __version_info__[:-1]])