Skip to content

Commit 39f0fd5

Browse files
authored
INTPYTHON-410 Set up trusted publishing (#169)
1 parent ae92343 commit 39f0fd5

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

.github/workflows/release-python.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Python Wheels
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
tags:
7+
- "**"
8+
pull_request:
9+
workflow_dispatch:
10+
11+
concurrency:
12+
group: wheels-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
defaults:
16+
run:
17+
shell: bash -eux {0}
18+
19+
jobs:
20+
21+
build_dist:
22+
name: Build Distribution Files
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
persist-credentials: false
29+
30+
- uses: actions/setup-python@v5
31+
with:
32+
# Build sdist on lowest supported Python
33+
python-version: '3.9'
34+
35+
- name: Install build
36+
run: |
37+
python -m pip install build
38+
39+
- name: build the dist files
40+
run: |
41+
python -m build .
42+
43+
- name: Upload the dist files
44+
uses: actions/upload-artifact@v4
45+
with:
46+
name: dist-${{ github.run_id }}
47+
path: ./dist/*.*
48+
49+
publish:
50+
# https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/#publishing-the-distribution-to-pypi
51+
needs: [build_dist]
52+
if: startsWith(github.ref, 'refs/tags/')
53+
runs-on: ubuntu-latest
54+
environment: release
55+
permissions:
56+
id-token: write
57+
steps:
58+
- name: Download the dists
59+
uses: actions/download-artifact@v4
60+
with:
61+
name: dist-${{ github.run_id }}
62+
path: dist/
63+
- name: Publish distribution 📦 to PyPI
64+
uses: pypa/gh-action-pypi-publish@release/v1
65+
with:
66+
repository-url: https://test.pypi.org/legacy/

0 commit comments

Comments
 (0)