Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 8 additions & 22 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,16 +154,14 @@ jobs:
- test-distribution
- test-source-distribution
runs-on: ubuntu-latest
# This environment stores the TWINE_USERNAME and TWINE_PASSWORD
# see https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment
# Publishes with PyPI Trusted Publishing, configured for this workflow and environment.
# See https://docs.pypi.org/trusted-publishers/
environment:
name: PyPI
url: https://pypi.org/project/icalendar/
# after using the environment, we need to make the secrets available
# see https://docs.github.com/en/actions/security-guides/encrypted-secrets#example-using-bash
env:
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Set up Python
Expand All @@ -178,22 +176,10 @@ jobs:
run: rm -rf dist/*
- name: build distribution files
run: python -m build # same as in test-distribution
- name: check distribution files
run: twine check dist/*
- name: deploy to pypi
run: |
# You will have to set the variables TWINE_USERNAME and TWINE_PASSWORD
# You can use a token specific to your project by setting the user name to
# __token__ and the password to the token given to you by the PyPI project.
# sources:
# - https://shambu2k.hashnode.dev/gitlab-to-pypi
# - http://blog.octomy.org/2020/11/deploying-python-pacakges-to-pypi-using.html?m=1
if [ -z "$TWINE_USERNAME" ]; then
echo "WARNING: TWINE_USERNAME not set!"
fi
if [ -z "$TWINE_PASSWORD" ]; then
echo "WARNING: TWINE_PASSWORD not set!"
fi
twine check dist/*
twine upload dist/*
uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3

deploy-github-release:
# only deploy on tags, see https://stackoverflow.com/a/58478262/1320237
Expand Down
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@
r"https://github.com/PyCalendar/icalendar/settings/",
r"https://groups.google.com/g/icalendar-coc/",
r"https://pypi.org/manage/project/icalendar/collaboration/",
r"https://pypi.org/manage/project/icalendar/settings/publishing/",
# Ignore specific anchors
r"https://github.com/actions/python-versions#support-policy",
r"https://github.com/PyCalendar/icalendar/blob/7ca9db18c0847d1530520e01baf75f8ab8f4fa06/pyproject.toml#L32",
Expand Down
1 change: 1 addition & 0 deletions docs/contribute/maintenance.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Maintainers need the following permissions.
Each owner and maintainer needs a PyPI account.
All PyPI accounts require two-factor authentication (2FA) enabled.
Owners can invite either new owners or maintainers in the `collaboration Section <https://pypi.org/manage/project/icalendar/collaboration/>`_ on PyPI.
Releases publish through `Trusted Publishing <https://docs.pypi.org/trusted-publishers/>`_, which owners manage on the project's `Publishing <https://pypi.org/manage/project/icalendar/settings/publishing/>`_ page.
``Maintainer`` access to the `Read the Docs project <https://app.readthedocs.org/projects/icalendar/>`_.
Existing maintainers can invite another maintainer through the `Maintainers <https://app.readthedocs.org/dashboard/icalendar/users/create/>`_ page.
``Environments/Configure PyPI`` access for GitHub Workflows to grant new releases from tags.
Expand Down
1 change: 1 addition & 0 deletions news/+trusted-publishing.internal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Releases now publish to PyPI with Trusted Publishing instead of a stored API token. @SashankBhamidi
2 changes: 1 addition & 1 deletion src/icalendar/tests/test_version_directives.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Check that Sphinx version directives use released versions.

``0.0.0`` is allowed until a release replaces it with the release version.
See https://github.com/collective/icalendar/issues/2026
See https://github.com/PyCalendar/icalendar/issues/2026
"""

import os
Expand Down
Loading