Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: modify publish workflow to allow pypi-trusted-publishing #202

Merged
merged 2 commits into from
Feb 13, 2024
Merged
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
13 changes: 8 additions & 5 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ env:
concurrency:
group: "publish"
cancel-in-progress: false

jobs:
publish-python:
runs-on: ubuntu-22.04 # convco needs GLIBC_2.32 which is not in 20.04
environment: publish
# IMPORTANT: trusted publishing requires permission: id-token: write! Without it, the trusted publishing will not work!
# If the permission is the only one that is set, all other permissions are automatically set to none, which may cause permissions issues within the job.
lukany marked this conversation as resolved.
Show resolved Hide resolved
permissions: write-all
outputs:
new_version: ${{ steps.set-vars.outputs.new_version }}
steps:
Expand Down Expand Up @@ -49,7 +51,7 @@ jobs:
echo "old version: $old_version"
echo "new version: $new_version"
echo "new tag: $new_tag"
- name: Release and publish
- name: Release
# Only run if the version has changed.
# Only start publishing automatically when the major version is 1 or higher.
if: ${{ env.OLD_VERSION != env.NEW_VERSION && env.NEW_MAJOR_VERSION >= 1 }}
Expand All @@ -71,11 +73,12 @@ jobs:
--notes-file ${{ env.CHANGELOG_FILE }} \
${{ env.FULL_CHANGELOG_FILE }}
########################################
# Publish to PyPI
# Build package
########################################
poetry config http-basic.pypi ${{ secrets.PYPI_USERNAME}} ${{ secrets.PYPI_PASSWORD }}
poetry version ${{ env.NEW_VERSION }}
poetry publish --build
poetry build
- name: Publish
uses: pypa/gh-action-pypi-publish@release/v1

build-docs:
runs-on: ubuntu-22.04
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ description = "Effective data visualization and reporting tool"
authors = ["Michal Belak <[email protected]>"]
include = ["example-datasets/*.csv"]
exclude = ["tests"]
readme = "README.md"

[tool.poetry.dependencies]
python = ">=3.8, <3.12"
Expand Down
Loading