@@ -24,13 +24,11 @@ jobs:
2424 run : sudo apt-get update && sudo apt-get install -y build-essential curl autoconf automake libtool pkg-config git
2525 - name : Compile shared library
2626 run : bash build/compile-linux.sh
27- - name : Create release archive
28- run : tar -czf build/libpostal-linux-x64.tar.gz -C postalkit/libs/linux-x64 libpostal.so
2927 - name : Upload workflow artifact
3028 uses : actions/upload-artifact@v4
3129 with :
3230 name : libpostal-linux-x64
33- path : build/libpostal- linux-x64.tar.gz
31+ path : postalkit/libs/ linux-x64/libpostal.so
3432
3533 build-linux-arm64 :
3634 name : Build Linux arm64
@@ -41,13 +39,11 @@ jobs:
4139 run : sudo apt-get update && sudo apt-get install -y build-essential curl autoconf automake libtool pkg-config git
4240 - name : Compile shared library
4341 run : bash build/compile-linux.sh
44- - name : Create release archive
45- run : tar -czf build/libpostal-linux-arm64.tar.gz -C postalkit/libs/linux-arm64 libpostal.so
4642 - name : Upload workflow artifact
4743 uses : actions/upload-artifact@v4
4844 with :
4945 name : libpostal-linux-arm64
50- path : build/libpostal- linux-arm64.tar.gz
46+ path : postalkit/libs/ linux-arm64/libpostal.so
5147
5248 build-macos-x64 :
5349 name : Build macOS x64
@@ -58,13 +54,11 @@ jobs:
5854 run : brew install autoconf automake libtool pkg-config
5955 - name : Compile shared library
6056 run : bash build/compile-macos.sh
61- - name : Create release archive
62- run : tar -czf build/libpostal-macos-x64.tar.gz -C postalkit/libs/macos-x64 libpostal.dylib
6357 - name : Upload workflow artifact
6458 uses : actions/upload-artifact@v4
6559 with :
6660 name : libpostal-macos-x64
67- path : build/libpostal- macos-x64.tar.gz
61+ path : postalkit/libs/ macos-x64/libpostal.dylib
6862
6963 build-macos-arm64 :
7064 name : Build macOS arm64
@@ -75,13 +69,11 @@ jobs:
7569 run : brew install autoconf automake libtool pkg-config
7670 - name : Compile shared library
7771 run : bash build/compile-macos.sh
78- - name : Create release archive
79- run : tar -czf build/libpostal-macos-arm64.tar.gz -C postalkit/libs/macos-arm64 libpostal.dylib
8072 - name : Upload workflow artifact
8173 uses : actions/upload-artifact@v4
8274 with :
8375 name : libpostal-macos-arm64
84- path : build/libpostal- macos-arm64.tar.gz
76+ path : postalkit/libs/ macos-arm64/libpostal.dylib
8577
8678 build-windows-x64 :
8779 name : Build Windows x64
@@ -97,17 +89,14 @@ jobs:
9789 - name : Compile shared library
9890 shell : msys2 {0}
9991 run : bash build/compile-windows.sh
100- - name : Create release archive
101- shell : pwsh
102- run : Compress-Archive -Path postalkit\libs\windows-x64\postal.dll -DestinationPath build\libpostal-windows-x64.zip -Force
10392 - name : Upload workflow artifact
10493 uses : actions/upload-artifact@v4
10594 with :
10695 name : libpostal-windows-x64
107- path : build/libpostal- windows-x64.zip
96+ path : postalkit/libs/ windows-x64/postal.dll
10897
109- upload- release-assets :
110- name : Upload Release Assets & Commit to Repo
98+ release-and-commit :
99+ name : Create GitHub Release and Commit Binaries
111100 needs : [build-linux-x64, build-linux-arm64, build-macos-x64, build-macos-arm64, build-windows-x64]
112101 runs-on : ubuntu-latest
113102 steps :
@@ -116,15 +105,35 @@ jobs:
116105 with :
117106 ref : main
118107
119- - name : Download all artifacts
108+ - name : Download all binaries
120109 uses : actions/download-artifact@v4
121110 with :
122- path : dist
123- merge-multiple : true
111+ path : postalkit/libs
112+ merge-multiple : false
124113
125- - name : Generate Checksums
114+ - name : Restructure downloaded artifacts
126115 run : |
127- cd dist
116+ # The artifacts are downloaded into folders named after the artifact name.
117+ # We need to move the actual files into the correct postalkit/libs structure.
118+ mv postalkit/libs/libpostal-linux-x64/libpostal.so postalkit/libs/linux-x64/
119+ mv postalkit/libs/libpostal-linux-arm64/libpostal.so postalkit/libs/linux-arm64/
120+ mv postalkit/libs/libpostal-macos-x64/libpostal.dylib postalkit/libs/macos-x64/
121+ mv postalkit/libs/libpostal-macos-arm64/libpostal.dylib postalkit/libs/macos-arm64/
122+ mv postalkit/libs/libpostal-windows-x64/postal.dll postalkit/libs/windows-x64/
123+
124+ # Clean up the empty artifact folders
125+ rm -rf postalkit/libs/libpostal-*
126+
127+ - name : Create Release Archives
128+ run : |
129+ mkdir -p dist_archives
130+ tar -czf dist_archives/libpostal-linux-x64.tar.gz -C postalkit/libs/linux-x64 libpostal.so
131+ tar -czf dist_archives/libpostal-linux-arm64.tar.gz -C postalkit/libs/linux-arm64 libpostal.so
132+ tar -czf dist_archives/libpostal-macos-x64.tar.gz -C postalkit/libs/macos-x64 libpostal.dylib
133+ tar -czf dist_archives/libpostal-macos-arm64.tar.gz -C postalkit/libs/macos-arm64 libpostal.dylib
134+ zip -j dist_archives/libpostal-windows-x64.zip postalkit/libs/windows-x64/postal.dll
135+
136+ cd dist_archives
128137 for file in *; do sha256sum "$file" > "${file}.sha256"; done
129138
130139 - name : Resolve target tag
@@ -140,51 +149,35 @@ jobs:
140149 uses : softprops/action-gh-release@v2
141150 with :
142151 tag_name : ${{ steps.target.outputs.tag }}
143- files : dist /*
152+ files : dist_archives /*
144153 fail_on_unmatched_files : true
145154
146155 - name : Commit Binaries to Repository
147156 run : |
148- # 1. Clean out archives from the folders
149- mkdir -p postalkit/libs/linux-x64 postalkit/libs/linux-arm64 postalkit/libs/macos-x64 postalkit/libs/macos-arm64 postalkit/libs/windows-x64
150-
151- # 2. Extract the actual library files into their git folders
152- tar -xzf dist/libpostal-linux-x64.tar.gz -C postalkit/libs/linux-x64
153- tar -xzf dist/libpostal-linux-arm64.tar.gz -C postalkit/libs/linux-arm64
154- tar -xzf dist/libpostal-macos-x64.tar.gz -C postalkit/libs/macos-x64
155- tar -xzf dist/libpostal-macos-arm64.tar.gz -C postalkit/libs/macos-arm64
156- unzip -o dist/libpostal-windows-x64.zip -d postalkit/libs/windows-x64
157-
158- # 3. Push to main branch
159157 git config --local user.name "github-actions[bot]"
160158 git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
161159 git add --force postalkit/libs/
162- git commit -m "chore: populate prebuilt binaries in libs/ directory [skip ci]" || echo "No changes to commit"
160+ git commit -m "chore: bundle prebuilt binaries for all 5 platforms [skip ci]" || echo "No changes to commit"
163161 git push origin main
164162
165163 publish-to-pypi :
166164 name : Publish Final Package to PyPI
167- needs : [upload- release-assets ]
165+ needs : [release-and-commit ]
168166 runs-on : ubuntu-latest
169167 permissions :
170168 id-token : write
171169 contents : read
172170 steps :
173171 - uses : actions/checkout@v4
174172 with :
175- ref : main # Pull the latest main with the committed binaries
176-
173+ ref : main
177174 - name : Set up Python
178175 uses : actions/setup-python@v5
179176 with :
180177 python-version : " 3.10"
181-
182178 - name : Install build tools
183179 run : python -m pip install --upgrade pip build
184-
185180 - name : Build and Publish
186- run : |
187- python -m build
188-
181+ run : python -m build
189182 - name : Publish package to PyPI
190183 uses : pypa/gh-action-pypi-publish@release/v1
0 commit comments