Skip to content

Commit

Permalink
ci: modify publish workflow to allow pypi-trusted-publishing (#202)
Browse files Browse the repository at this point in the history
  • Loading branch information
jzizka91 authored Feb 13, 2024
1 parent 29cb1fd commit 612b8cb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
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.
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 <michal.belak@datamole.ai>"]
include = ["example-datasets/*.csv"]
exclude = ["tests"]
readme = "README.md"

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

0 comments on commit 612b8cb

Please sign in to comment.