INTPYTHON-596 Add automated release workflow #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Python Dist | |
on: | |
push: | |
tags: | |
- "[0-9]+.[0-9]+.[0-9]+" | |
- "[0-9]+.[0-9]+.[0-9]+.post[0-9]+" | |
- "[0-9]+.[0-9]+.[0-9]+[a-b][0-9]+" | |
- "[0-9]+.[0-9]+.[0-9]+rc[0-9]+" | |
workflow_dispatch: | |
pull_request: | |
workflow_call: | |
inputs: | |
ref: | |
required: true | |
type: string | |
concurrency: | |
group: dist-${{ github.ref }} | |
cancel-in-progress: true | |
defaults: | |
run: | |
shell: bash -eux {0} | |
jobs: | |
make_dist: | |
name: Make Dist | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- uses: actions/setup-python@v5 | |
with: | |
# Build sdist on lowest supported Python | |
python-version: '3.9' | |
- name: Install python requirements | |
run: | | |
python -m pip install uv rust-just build | |
- name: Build Dist | |
run: | | |
python -m build . | |
- name: Test SDist | |
run: | | |
python -m pip install dist/*.gz | |
cd .. | |
python -c "from pymongoexplain import ExplainableCollection" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: "dist" | |
path: ./dist/*.* | |
collect_dist: | |
runs-on: ubuntu-latest | |
needs: [make_dist] | |
name: Download Dist | |
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-${{ github.run_id }} | |
path: "./*" |