Skip to content

Commit 168104d

Browse files
committed
CICD: modernize step for publishing to pypi, use trusted publisher workflow rather than username/pass
1 parent ad3b57d commit 168104d

File tree

1 file changed

+32
-16
lines changed

1 file changed

+32
-16
lines changed

.github/workflows/cicd.yml

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -60,26 +60,42 @@ jobs:
6060
with:
6161
github-token: ${{ secrets.GITHUB_TOKEN }}
6262
path-to-lcov: coverage.lcov
63-
deploy:
64-
name: Deploy to PyPi
63+
build:
64+
name: Build pydantic2ts for distribution
65+
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
6566
needs: test
6667
runs-on: ubuntu-latest
67-
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
6868
steps:
6969
- name: Check out repo
7070
uses: actions/checkout@v4
71-
- name: Set up Python 3.9
72-
uses: actions/setup-python@v5
71+
- name: Install uv
72+
uses: astral-sh/setup-uv@v3
7373
with:
74-
python-version: 3.9
75-
- name: Install dependencies
76-
run: |
77-
python -m pip install -U pip wheel
78-
- name: Build dist
79-
run: |
80-
python setup.py sdist bdist_wheel bdist_egg
81-
- name: Publish package
82-
uses: pypa/gh-action-pypi-publish@v1.5.0
74+
version: "0.5.2"
75+
- name: Install python 3.9
76+
run: uv python install 3.9
77+
- name: Build pydantic2ts
78+
run: uv build
79+
- name: Store the distribution
80+
uses: actions/upload-artifact@v4
81+
with:
82+
name: pydantic2ts-dist
83+
path: dist/
84+
publish-to-pypi:
85+
name: Publish pydantic2ts to PyPI
86+
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
87+
needs: build
88+
runs-on: ubuntu-latest
89+
environment:
90+
name: pypi
91+
url: https://pypi.org/p/pydantic-to-typescript
92+
permissions:
93+
id-token: write
94+
steps:
95+
- name: Download all the dists
96+
uses: actions/download-artifact@v4
8397
with:
84-
user: __token__
85-
password: ${{ secrets.pypi_password }}
98+
name: pydantic2ts-dist
99+
path: dist/
100+
- name: Publish distributions to PyPI
101+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)