Skip to content

Commit 89893b4

Browse files
authored
PYTHON-4107 [python-bsonjs] Use PyPI Trusted Publishing (#52)
* PYTHON-4107 [python-bsonjs] Use PyPI Trusted Publishing * update codeowners * update action versions
1 parent 2c9efd6 commit 89893b4

File tree

3 files changed

+38
-20
lines changed

3 files changed

+38
-20
lines changed

.github/CODEOWNERS

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# Global owner for repo
2-
* @blink1073 @juliusgeo @ShaneHarvey
2+
* @mongodb-labs/dbx-python

.github/workflows/release-python.yml

+36-18
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,39 @@ name: Python Wheels
22

33
on:
44
push:
5-
branches: ["master"]
65
tags:
7-
- "**"
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]+"
810
pull_request:
911
workflow_dispatch:
1012

1113
concurrency:
1214
group: wheels-${{ github.ref }}
1315
cancel-in-progress: true
1416

15-
1617
jobs:
17-
build-wheels:
18+
build_wheels:
1819
runs-on: ${{ matrix.os }}
1920
strategy:
2021
matrix:
2122
os: [macos-latest, windows-2019, ubuntu-latest]
2223
name: Build CPython ${{ matrix.python-version }}-${{ matrix.os }}
2324
steps:
24-
- uses: actions/checkout@v2
25+
- uses: actions/checkout@v4
2526
- uses: pypa/cibuildwheel@v2.11.2
2627
env:
2728
CIBW_ARCHS_MACOS: x86_64 universal2
2829
CIBW_TEST_SKIP: '*universal2:arm64'
2930
CIBW_BUILD: "cp37-macosx_x86_64 cp38-macosx_universal2 cp37-win* cp37-manylinux_{x86_64,i686}"
30-
- uses: actions/upload-artifact@v2
31+
- uses: actions/upload-artifact@v3
3132
with:
3233
name: python_bsonjs-3.7-${{ matrix.os }}-wheel
3334
path: ./wheelhouse/*.whl
3435
if-no-files-found: error
35-
test-non-linux-wheels:
36-
needs: build-wheels
36+
test_non_linux_wheels:
37+
needs: build_wheels
3738
runs-on: ${{ matrix.os }}
3839
strategy:
3940
matrix:
@@ -58,9 +59,9 @@ jobs:
5859
python -m pip list | grep python-bsonjs
5960
python -c "from bsonjs import dumps"
6061
# Linux
61-
test-manylinux-wheels:
62+
test_manylinux_wheels:
6263
runs-on: ${{ matrix.os }}
63-
needs: build-wheels
64+
needs: build_wheels
6465
strategy:
6566
matrix:
6667
os: [ubuntu-latest]
@@ -80,25 +81,42 @@ jobs:
8081
name: Make SDist
8182
runs-on: ubuntu-latest
8283
steps:
83-
- uses: actions/checkout@v2
84+
- uses: actions/checkout@v4
8485
- name: Build SDist
8586
run: python setup.py sdist --dist-dir=dist --formats=gztar
86-
- uses: actions/upload-artifact@v2
87+
- uses: actions/upload-artifact@v3
8788
with:
8889
name: "sdist"
8990
path: dist/*.tar.gz
90-
collect-wheels:
91+
collect_dist:
9192
runs-on: ubuntu-latest
92-
needs: [build-wheels, make_sdist]
93+
needs: [build_wheels, make_sdist]
9394
name: Download Wheels
9495
steps:
9596
- name: Download all workflow run artifacts
96-
uses: actions/download-artifact@v2
97+
uses: actions/download-artifact@v3
9798
- name: Flatten directory
99+
working-directory: .
98100
run: |
99101
find . -mindepth 2 -type f -exec mv {} . \;
100102
find . -type d -empty -delete
101-
- uses: actions/upload-artifact@v2
103+
- uses: actions/upload-artifact@v3
102104
with:
103-
name: all-dist
104-
path: "./*"
105+
name: all-dist-${{ github.head_ref || github.ref_name }}
106+
path: "./*"
107+
publish:
108+
# https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/#publishing-the-distribution-to-pypi
109+
needs: [collect_dist]
110+
if: startsWith(github.ref, 'refs/tags/')
111+
runs-on: ubuntu-latest
112+
environment: release
113+
permissions:
114+
id-token: write
115+
steps:
116+
- name: Download all the dists
117+
uses: actions/download-artifact@v3
118+
with:
119+
name: all-dist-${{ github.head_ref || github.ref_name }}
120+
path: dist/
121+
- name: Publish distribution 📦 to PyPI
122+
uses: pypa/gh-action-pypi-publish@release/v1

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["setuptools"]
2+
requires = ["setuptools>=62.0"]
33
build-backend = "setuptools.build_meta"
44

55
[project]

0 commit comments

Comments
 (0)