Skip to content

Commit 574f9e5

Browse files
author
jayeshmepani
committed
feat: automate bundling of all 5 platform binaries into the PyPI wheel
1 parent 7cbb9a2 commit 574f9e5

1 file changed

Lines changed: 32 additions & 4 deletions

File tree

.github/workflows/publish-pypi.yml

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@ name: Publish to PyPI
33
on:
44
release:
55
types: [published]
6-
workflow_dispatch: # Allow manual triggering
6+
workflow_dispatch:
7+
inputs:
8+
tag:
9+
description: Tag name to publish
10+
required: true
11+
type: string
712

813
env:
914
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
@@ -13,8 +18,8 @@ jobs:
1318
name: Build and publish to PyPI
1419
runs-on: ubuntu-latest
1520
permissions:
16-
id-token: write # IMPORTANT: mandatory for trusted publishing
17-
contents: read # This is required for actions/checkout
21+
id-token: write
22+
contents: read
1823

1924
steps:
2025
- uses: actions/checkout@v4
@@ -27,7 +32,30 @@ jobs:
2732
- name: Install build dependencies
2833
run: python -m pip install --upgrade pip build twine
2934

30-
- name: Build Python Package (sdist and wheel)
35+
- name: Download all prebuilt binaries from Release
36+
uses: robinraju/release-downloader@v1.11
37+
with:
38+
repository: "jayeshmepani/libpostal-ffi-python"
39+
tag: ${{ github.event.release.tag_name || github.event.inputs.tag }}
40+
fileName: "*"
41+
out-file_path: "temp_binaries"
42+
43+
- name: Structure and Extract Binaries
44+
run: |
45+
mkdir -p postalkit/libs/linux-x64
46+
mkdir -p postalkit/libs/linux-arm64
47+
mkdir -p postalkit/libs/macos-x64
48+
mkdir -p postalkit/libs/macos-arm64
49+
mkdir -p postalkit/libs/windows-x64
50+
51+
# Extract each archive into its specific folder
52+
tar -xzf temp_binaries/libpostal-linux-x64.tar.gz -C postalkit/libs/linux-x64
53+
tar -xzf temp_binaries/libpostal-linux-arm64.tar.gz -C postalkit/libs/linux-arm64
54+
tar -xzf temp_binaries/libpostal-macos-x64.tar.gz -C postalkit/libs/macos-x64
55+
tar -xzf temp_binaries/libpostal-macos-arm64.tar.gz -C postalkit/libs/macos-arm64
56+
unzip temp_binaries/libpostal-windows-x64.zip -d postalkit/libs/windows-x64
57+
58+
- name: Build Python Package (Bundled)
3159
run: python -m build
3260

3361
- name: Publish package to PyPI

0 commit comments

Comments
 (0)