1111 required : true
1212 type : string
1313
14- env :
15- FORCE_JAVASCRIPT_ACTIONS_TO_NODE24 : true
16-
1714permissions :
1815 contents : write
1916
@@ -23,150 +20,115 @@ jobs:
2320 runs-on : ubuntu-24.04
2421 steps :
2522 - uses : actions/checkout@v4
26-
2723 - name : Install build tools
2824 run : sudo apt-get update && sudo apt-get install -y build-essential curl autoconf automake libtool pkg-config git
29-
3025 - name : Compile shared library
3126 run : bash build/compile-linux.sh
32-
3327 - name : Create release archive
3428 run : tar -czf build/libpostal-linux-x64.tar.gz -C postalkit/libs/linux-x64 libpostal.so
35-
3629 - name : Upload workflow artifact
3730 uses : actions/upload-artifact@v4
3831 with :
3932 name : libpostal-linux-x64
4033 path : build/libpostal-linux-x64.tar.gz
41- if-no-files-found : error
4234
4335 build-linux-arm64 :
4436 name : Build Linux arm64
4537 runs-on : ubuntu-24.04-arm
4638 steps :
4739 - uses : actions/checkout@v4
48-
4940 - name : Install build tools
5041 run : sudo apt-get update && sudo apt-get install -y build-essential curl autoconf automake libtool pkg-config git
51-
5242 - name : Compile shared library
5343 run : bash build/compile-linux.sh
54-
5544 - name : Create release archive
5645 run : tar -czf build/libpostal-linux-arm64.tar.gz -C postalkit/libs/linux-arm64 libpostal.so
57-
5846 - name : Upload workflow artifact
5947 uses : actions/upload-artifact@v4
6048 with :
6149 name : libpostal-linux-arm64
6250 path : build/libpostal-linux-arm64.tar.gz
63- if-no-files-found : error
6451
6552 build-macos-x64 :
6653 name : Build macOS x64
6754 runs-on : macos-15-intel
6855 steps :
6956 - uses : actions/checkout@v4
70-
7157 - name : Install build tools
7258 run : brew install autoconf automake libtool pkg-config
73-
7459 - name : Compile shared library
7560 run : bash build/compile-macos.sh
76-
7761 - name : Create release archive
7862 run : tar -czf build/libpostal-macos-x64.tar.gz -C postalkit/libs/macos-x64 libpostal.dylib
79-
8063 - name : Upload workflow artifact
8164 uses : actions/upload-artifact@v4
8265 with :
8366 name : libpostal-macos-x64
8467 path : build/libpostal-macos-x64.tar.gz
85- if-no-files-found : error
8668
8769 build-macos-arm64 :
8870 name : Build macOS arm64
8971 runs-on : macos-14
9072 steps :
9173 - uses : actions/checkout@v4
92-
9374 - name : Install build tools
9475 run : brew install autoconf automake libtool pkg-config
95-
9676 - name : Compile shared library
9777 run : bash build/compile-macos.sh
98-
9978 - name : Create release archive
10079 run : tar -czf build/libpostal-macos-arm64.tar.gz -C postalkit/libs/macos-arm64 libpostal.dylib
101-
10280 - name : Upload workflow artifact
10381 uses : actions/upload-artifact@v4
10482 with :
10583 name : libpostal-macos-arm64
10684 path : build/libpostal-macos-arm64.tar.gz
107- if-no-files-found : error
10885
10986 build-windows-x64 :
11087 name : Build Windows x64
11188 runs-on : windows-2022
11289 steps :
11390 - uses : actions/checkout@v4
114-
115- - name : Set up MSYS2 with MinGW
91+ - name : Set up MSYS2
11692 uses : msys2/setup-msys2@v2
11793 with :
11894 msystem : MINGW64
11995 update : true
120- install : >-
121- base-devel
122- mingw-w64-x86_64-toolchain
123- autoconf
124- automake
125- libtool
126- git
127-
96+ install : base-devel mingw-w64-x86_64-toolchain autoconf automake libtool git
12897 - name : Compile shared library
12998 shell : msys2 {0}
13099 run : bash build/compile-windows.sh
131-
132100 - name : Create release archive
133101 shell : pwsh
134102 run : Compress-Archive -Path postalkit\libs\windows-x64\postal.dll -DestinationPath build\libpostal-windows-x64.zip -Force
135-
136103 - name : Upload workflow artifact
137104 uses : actions/upload-artifact@v4
138105 with :
139106 name : libpostal-windows-x64
140107 path : build/libpostal-windows-x64.zip
141- if-no-files-found : error
142108
143109 upload-release-assets :
144- name : Upload Release Assets
145- if : github.event_name == 'release' || github.event_name == 'workflow_dispatch'
146- needs :
147- - build-linux-x64
148- - build-linux-arm64
149- - build-macos-x64
150- - build-macos-arm64
151- - build-windows-x64
110+ name : Upload Release Assets & Commit to Repo
111+ needs : [build-linux-x64, build-linux-arm64, build-macos-x64, build-macos-arm64, build-windows-x64]
152112 runs-on : ubuntu-latest
153113 steps :
154- - name : Download workflow artifacts
114+ - name : Checkout repository
115+ uses : actions/checkout@v4
116+ with :
117+ ref : main
118+
119+ - name : Download all artifacts
155120 uses : actions/download-artifact@v4
156121 with :
157122 path : dist
158123 merge-multiple : true
159124
160- - name : Generate SHA256 Checksums
125+ - name : Generate Checksums
161126 run : |
162127 cd dist
163- for file in *; do
164- sha256sum "$file" > "${file}.sha256"
165- done
128+ for file in *; do sha256sum "$file" > "${file}.sha256"; done
166129
167130 - name : Resolve target tag
168131 id : target
169- shell : bash
170132 run : |
171133 if [ "${{ github.event_name }}" = "release" ]; then
172134 echo "tag=${{ github.event.release.tag_name }}" >> "$GITHUB_OUTPUT"
@@ -178,15 +140,24 @@ jobs:
178140 uses : softprops/action-gh-release@v2
179141 with :
180142 tag_name : ${{ steps.target.outputs.tag }}
181- files : |
182- dist/libpostal-linux-x64.tar.gz
183- dist/libpostal-linux-x64.tar.gz.sha256
184- dist/libpostal-linux-arm64.tar.gz
185- dist/libpostal-linux-arm64.tar.gz.sha256
186- dist/libpostal-macos-x64.tar.gz
187- dist/libpostal-macos-x64.tar.gz.sha256
188- dist/libpostal-macos-arm64.tar.gz
189- dist/libpostal-macos-arm64.tar.gz.sha256
190- dist/libpostal-windows-x64.zip
191- dist/libpostal-windows-x64.zip.sha256
143+ files : dist/*
192144 fail_on_unmatched_files : true
145+
146+ - name : Commit Binaries to Repository
147+ 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 dist/libpostal-windows-x64.zip -d postalkit/libs/windows-x64
157+
158+ # 3. Push to main branch
159+ git config --local user.name "github-actions[bot]"
160+ git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
161+ git add postalkit/libs/
162+ git commit -m "chore: populate prebuilt binaries in libs/ directory [skip ci]" || echo "No changes to commit"
163+ git push origin main
0 commit comments