Skip to content

Commit f7bc809

Browse files
authored
ci: add pypi-publish workflow
* ci: add pypi-publish workflow * Change Python version from 3.13 to 3.11
1 parent ef88cdb commit f7bc809

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed

.github/workflows/pypi-publish.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
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: Upload PyPI Package
10+
11+
on:
12+
release:
13+
types: [published]
14+
15+
permissions:
16+
contents: read
17+
18+
jobs:
19+
release-build:
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
25+
- uses: actions/setup-python@v5
26+
with:
27+
python-version: "3.11"
28+
- name: Install Hatch
29+
run: |
30+
python -m pip install --upgrade hatch
31+
- name: Build release distributions
32+
run: |
33+
# NOTE: put your own distribution build steps here.
34+
hatch build
35+
36+
- name: Upload distributions
37+
uses: actions/upload-artifact@v4
38+
with:
39+
name: release-dists
40+
path: dist/
41+
42+
pypi-publish:
43+
runs-on: ubuntu-latest
44+
needs:
45+
- release-build
46+
permissions:
47+
# IMPORTANT: this permission is mandatory for trusted publishing
48+
id-token: write
49+
50+
# Dedicated environments with protections for publishing are strongly recommended.
51+
# For more information, see: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#deployment-protection-rules
52+
environment:
53+
name: pypi
54+
# OPTIONAL: uncomment and update to include your PyPI project URL in the deployment status:
55+
# url: https://pypi.org/p/aws-durable-execution-sdk-python-testing
56+
#
57+
# ALTERNATIVE: if your GitHub Release name is the PyPI project version string
58+
# ALTERNATIVE: exactly, uncomment the following line instead:
59+
url: https://pypi.org/project/aws-durable-execution-sdk-python-testing/${{ github.event.release.name }}
60+
61+
steps:
62+
- name: Retrieve release distributions
63+
uses: actions/download-artifact@v4
64+
with:
65+
name: release-dists
66+
path: dist/
67+
68+
- name: Publish release distributions to PyPI
69+
uses: pypa/gh-action-pypi-publish@release/v1
70+
with:
71+
packages-dir: dist/

0 commit comments

Comments
 (0)