Skip to content

Commit e681b9c

Browse files
Update python-publish.yml
1 parent f5e6657 commit e681b9c

File tree

1 file changed

+17
-24
lines changed

1 file changed

+17
-24
lines changed

.github/workflows/python-publish.yml

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
1-
# This workflow will upload a Python Package to PyPI when a release is created
2-
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
3-
4-
# This workflow uses actions that are not certified by GitHub.
5-
# They are provided by a third-party and are governed by
6-
# separate terms of service, privacy policy, and support
7-
# documentation.
8-
9-
name: pygrokai
1+
name: Publish to PyPI
102

113
on:
124
release:
@@ -16,7 +8,7 @@ permissions:
168
contents: read
179

1810
jobs:
19-
release-build:
11+
test-and-build:
2012
runs-on: ubuntu-latest
2113

2214
steps:
@@ -26,11 +18,19 @@ jobs:
2618
with:
2719
python-version: "3.x"
2820

21+
- name: Install dependencies
22+
run: |
23+
python -m pip install --upgrade pip
24+
pip install poetry
25+
poetry install
26+
27+
- name: Run tests
28+
run: |
29+
poetry run pytest
30+
2931
- name: Build release distributions
3032
run: |
31-
# NOTE: put your own distribution build steps here.
32-
python -m pip install build
33-
python -m build
33+
poetry build
3434
3535
- name: Upload distributions
3636
uses: actions/upload-artifact@v4
@@ -40,22 +40,12 @@ jobs:
4040

4141
pypi-publish:
4242
runs-on: ubuntu-latest
43-
needs:
44-
- release-build
43+
needs: test-and-build
4544
permissions:
46-
# IMPORTANT: this permission is mandatory for trusted publishing
4745
id-token: write
4846

49-
# Dedicated environments with protections for publishing are strongly recommended.
50-
# For more information, see: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#deployment-protection-rules
5147
environment:
5248
name: pypi
53-
# OPTIONAL: uncomment and update to include your PyPI project URL in the deployment status:
54-
# url: https://pypi.org/p/YOURPROJECT
55-
#
56-
# ALTERNATIVE: if your GitHub Release name is the PyPI project version string
57-
# ALTERNATIVE: exactly, uncomment the following line instead:
58-
# url: https://pypi.org/project/YOURPROJECT/${{ github.event.release.name }}
5949

6050
steps:
6151
- name: Retrieve release distributions
@@ -68,3 +58,6 @@ jobs:
6858
uses: pypa/gh-action-pypi-publish@release/v1
6959
with:
7060
packages-dir: dist/
61+
env:
62+
TWINE_USERNAME: "__token__"
63+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}

0 commit comments

Comments
 (0)