Skip to content

Commit 722e737

Browse files
authored
PYTHON-4106 [winkerberos] Use PyPI Trusted Publishing (#59)
* PYTHON-4106 [winkerberos] Use PyPI Trusted Publishing * keep wheel building on PRs
1 parent 9a77342 commit 722e737

File tree

1 file changed

+31
-5
lines changed

1 file changed

+31
-5
lines changed

.github/workflows/release.yml renamed to .github/workflows/release-python.yml

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
name: Python Wheels
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
tags:
6+
- "[0-9]+.[0-9]+.[0-9]+"
7+
- "[0-9]+.[0-9]+.[0-9]+.post[0-9]+"
8+
- "[0-9]+.[0-9]+.[0-9]+[a-b][0-9]+"
9+
- "[0-9]+.[0-9]+.[0-9]+rc[0-9]+"
10+
workflow_dispatch:
11+
pull_request:
412

513
concurrency:
614
group: release-${{ github.ref }}
@@ -43,18 +51,36 @@ jobs:
4351
name: "sdist"
4452
path: dist/*.zip
4553

46-
collect_wheels:
54+
collect_dist:
4755
runs-on: ubuntu-latest
4856
needs: [build_wheels, make_sdist]
4957
name: Download Wheels
5058
steps:
5159
- name: Download all workflow run artifacts
52-
uses: actions/download-artifact@v2
60+
uses: actions/download-artifact@v3
5361
- name: Flatten directory
62+
working-directory: .
5463
run: |
5564
find . -mindepth 2 -type f -exec mv {} . \;
5665
find . -type d -empty -delete
57-
- uses: actions/upload-artifact@v2
66+
- uses: actions/upload-artifact@v3
5867
with:
59-
name: all-dist
68+
name: all-dist-${{ github.head_ref || github.ref_name }}
6069
path: "./*"
70+
71+
publish:
72+
# https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/#publishing-the-distribution-to-pypi
73+
needs: [collect_dist]
74+
if: startsWith(github.ref, 'refs/tags/')
75+
runs-on: ubuntu-latest
76+
environment: release
77+
permissions:
78+
id-token: write
79+
steps:
80+
- name: Download all the dists
81+
uses: actions/download-artifact@v3
82+
with:
83+
name: all-dist-${{ github.head_ref || github.ref_name }}
84+
path: dist/
85+
- name: Publish distribution 📦 to PyPI
86+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)