Skip to content

Commit 8a2b7b8

Browse files
committed
feat: Deploy to pypi on release
1 parent 73dae72 commit 8a2b7b8

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Publish Python Package
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
8+
jobs:
9+
build:
10+
name: Build distribution 📦
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
with:
16+
persist-credentials: false
17+
18+
- name: Set up Python
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: '3.10'
22+
23+
- name: Install dependencies
24+
run: |
25+
python -m pip install --upgrade pip
26+
pip install hatch twine
27+
28+
- name: Build
29+
run: |
30+
hatch build
31+
32+
- name: Store the distribution packages
33+
uses: actions/upload-artifact@v4
34+
with:
35+
name: python-package-distributions
36+
path: dist/
37+
38+
deploy:
39+
name: Upload release to PyPI
40+
needs:
41+
- build
42+
runs-on: ubuntu-latest
43+
44+
# environment is used by PyPI Trusted Publisher and is strongly encouraged
45+
# https://docs.pypi.org/trusted-publishers/adding-a-publisher/
46+
environment:
47+
name: testpypi
48+
url: https://test.pypi.org/p/strands-agents
49+
permissions:
50+
# IMPORTANT: this permission is mandatory for Trusted Publishing
51+
id-token: write
52+
53+
steps:
54+
- name: Download all the dists
55+
uses: actions/download-artifact@v4
56+
with:
57+
name: python-package-distributions
58+
path: dist/
59+
60+
- name: Publish distribution 📦 to TestPyPI
61+
uses: pypa/gh-action-pypi-publish@release/v1
62+
with:
63+
repository-url: https://test.pypi.org/legacy/

0 commit comments

Comments
 (0)