@@ -20,12 +20,20 @@ jobs:
2020 persist-credentials : false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token
2121 fetch-depth : 0 # otherwise, you will failed to push refs to dest repo
2222
23- - uses : actions/setup-python@v2
23+ - name : Set up Python
24+ uses : ni/python-actions/setup-python@97860b52be87c788fb6df812bd8d1ca68c7aa885 # v0.3.0
25+ - name : Set up Poetry
26+ uses : ni/python-actions/setup-poetry@97860b52be87c788fb6df812bd8d1ca68c7aa885 # v0.3.0
27+ - name : Check project version
28+ if : github.event_name == 'release'
29+ uses : ni/python-actions/check-project-version@97860b52be87c788fb6df812bd8d1ca68c7aa885 # v0.3.0
30+ - name : Build distribution packages
31+ run : poetry build
32+ - name : Upload build artifacts
33+ uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
2434 with :
25- python-version : ${{ env.PYTHON_VERSION }}
26- - uses : Gr1N/setup-poetry@v8
27- with :
28- poetry-version : ${{ env.POETRY_VERSION }}
35+ name : ${{ env.dist-artifact-name }}
36+ path : dist/*
2937 # @TODO: This is a workaround for there not being a way to check the lock file
3038 # See: https://github.com/python-poetry/poetry/issues/453
3139 - name : Check for lock changes
@@ -45,30 +53,25 @@ jobs:
4553
4654 # If the version is 0.1.0-alpha.0, this will set the version to 0.1.0
4755 - name : Promote package version to release
56+ uses : ni/python-actions/update-project-version@97860b52be87c788fb6df812bd8d1ca68c7aa885 # v0.3.0
57+ with :
58+ create-pull-request : false
59+ commit-message : " Bump package version to minor release version"
60+ version-rule : " minor"
61+ - name : Build Python package
62+ if : ${{ github.event.release.target_commitish == 'main' || startsWith(github.event.release.target_commitish, 'releases/')}}
4863 run : |
49- poetry version patch
50-
51- - name : Build Python package and publish to PyPI
52- if : ${{ github.event.release.target_commitish == 'main' }}
53- run : |
54- poetry publish --build --username __token__ --password ${{ secrets.PYPI_TOKEN}}
64+ poetry build
5565
66+ - name : Upload Python package
67+ if : ${{ github.event.release.target_commitish == 'main' || startsWith(github.event.release.target_commitish, 'releases/')}}
68+ uses : pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
69+ with :
70+ packages-dir : dist/
71+
5672 - name : Bump poetry version to next alpha version
57- run : |
58- poetry version prepatch
59-
60- - name : Commit files
61- if : ${{ github.event.release.target_commitish == 'main' }}
62- run : |
63- git config --local user.email "[email protected] " 64- git config --local user.name "GitHub Action"
65- git pull --tags -f
66- git commit -m "Bump package version" -a
67-
68- - name : Push changes
69- if : ${{ github.event.release.target_commitish == 'main' }}
70- uses : CasperWA/push-protected@v2
73+ uses : ni/python-actions/update-project-version@97860b52be87c788fb6df812bd8d1ca68c7aa885 # v0.3.0
7174 with :
72- token : ${{ secrets.ADMIN_PAT }}
73- branch : ${{ github.event.release.target_commitish }}
74- unprotect_reviews : true
75+ create-pull-request : true
76+ commit-message : " Bump package version "
77+ version-rule : " prepatch "
0 commit comments