forked from MemMachine/MemMachine
-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (51 loc) · 1.98 KB
/
build-python.yml
File metadata and controls
60 lines (51 loc) · 1.98 KB
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
# Reusable GitHub Actions workflow for building Python packages
name: Build python package
permissions:
contents: read
on:
workflow_call:
inputs:
python-version:
description: 'Python version'
required: false
type: string
default: '3.x'
patch-version:
description: 'Version to patch into pyproject.toml'
required: false
type: string
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up Python ${{ inputs.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
- name: Patch version in pyproject.toml
if: inputs.patch-version != ''
run: |
VERSION="${{ inputs.patch-version }}"
echo "Updating pyproject.toml version to $VERSION"
sed -i -E "s/^version = \".*\"/version = \"$VERSION\"/" pyproject.toml
sed -i -E "s/^version = \".*\"/version = \"$VERSION\"/" packages/client/pyproject.toml
sed -i -E "s/^version = \".*\"/version = \"$VERSION\"/" packages/server/pyproject.toml
sed -i -E "s/^version = \".*\"/version = \"$VERSION\"/" packages/meta/pyproject.toml
sed -i -E "s/\"memmachine-client==.*\"/\"memmachine-client==$VERSION\"/" packages/meta/pyproject.toml
sed -i -E "s/\"memmachine-server==.*\"/\"memmachine-server==$VERSION\"/" packages/meta/pyproject.toml
- name: Install dependencies and uv
run: |
python -m pip install --upgrade pip
pip install --upgrade build
pip install uv
- name: Build the packages with uv
run: |
uv build --project packages/client && uv build --project packages/server && uv build --project packages/meta
ls -lh dist/
- name: Upload built distributions as artifact
uses: actions/upload-artifact@v4
with:
name: python-package-dist
path: dist/*