-
Notifications
You must be signed in to change notification settings - Fork 88
89 lines (79 loc) · 2.36 KB
/
release-python.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
name: Python Release
on:
push:
tags:
- "pymongocrypt-[0-9]+.[0-9]+.[0-9]+"
- "pymongocrypt-[0-9]+.[0-9]+.[0-9]+.post[0-9]+"
- "pymongocrypt-[0-9]+.[0-9]+.[0-9]+[a-b][0-9]+"
- "pymongocrypt-[0-9]+.[0-9]+.[0-9]+rc[0-9]+"
pull_request:
paths:
- bindings/python/*
workflow_dispatch:
concurrency:
group: python-release-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
working-directory: ./bindings/python
shell: bash -eux {0}
jobs:
build_dist:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
fail-fast: false
steps:
- name: Checkout libmongocrypt
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: 3.8
cache: 'pip'
cache-dependency-path: 'bindings/python/pyproject.toml'
allow-prereleases: true
- name: Build and test dist files
run: |
export LIBMONGOCRYPT_VERSION=$(cat ./libmongocrypt-version.txt)
git fetch origin $LIBMONGOCRYPT_VERSION
bash ./release.sh
- uses: actions/upload-artifact@v4
with:
name: dist-${{ matrix.os }}
path: ./bindings/python/dist/*.*
if-no-files-found: error
collect_dist:
runs-on: ubuntu-latest
needs: [build_dist]
name: Collect dist files
steps:
- name: Download all workflow run artifacts
uses: actions/download-artifact@v4
- name: Flatten directory
working-directory: .
run: |
find . -mindepth 2 -type f -exec mv {} . \;
find . -type d -empty -delete
- uses: actions/upload-artifact@v4
with:
name: all-dist
path: "./*"
publish:
# https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/#publishing-the-distribution-to-pypi
needs: [collect_dist]
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
environment: release-python
permissions:
id-token: write
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: all-dist
path: dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1