Skip to content

Commit bc5ebb7

Browse files
authored
set up action to publish to PyPI on release (#1270)
This is following https://docs.github.com/en/actions/security-for-github-actions/security-hardening-your-deployments/configuring-openid-connect-in-pypi An environment "release" has been created. Will follow #688 as the release process.
1 parent efba59d commit bc5ebb7

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

.github/workflows/release.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# mostly borrowed from https://docs.github.com/en/actions/security-for-github-actions/security-hardening-your-deployments/configuring-openid-connect-in-pypi
2+
3+
name: Publish a Release to PyPI
4+
5+
on:
6+
release:
7+
types: [published]
8+
9+
jobs:
10+
release-build:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- uses: actions/setup-python@v5
17+
with:
18+
python-version: "3.x"
19+
20+
- name: build release distributions
21+
run: |
22+
python -m pip install build
23+
python -m build
24+
25+
- name: upload windows dists
26+
uses: actions/upload-artifact@v4
27+
with:
28+
name: release-dists
29+
path: dist/
30+
31+
pypi-publish:
32+
runs-on: ubuntu-latest
33+
needs:
34+
- release-build
35+
permissions:
36+
id-token: write
37+
environment:
38+
name: release
39+
url: https://pypi.org/p/torchtitan
40+
41+
steps:
42+
- name: Retrieve release distributions
43+
uses: actions/download-artifact@v4
44+
with:
45+
name: release-dists
46+
path: dist/
47+
48+
- name: Publish release distributions to PyPI
49+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)