v1.0.5 - Official Universal Release #22
Workflow file for this run
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: Release Prebuilt Libraries | |
| on: | |
| release: | |
| types: | |
| - published | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: Tag name to upload assets to, for example v1.0.0 | |
| required: true | |
| type: string | |
| permissions: | |
| contents: write | |
| jobs: | |
| build-linux-x64: | |
| name: Build Linux x64 | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install build tools | |
| run: sudo apt-get update && sudo apt-get install -y build-essential curl autoconf automake libtool pkg-config git | |
| - name: Compile shared library | |
| run: bash build/compile-linux.sh | |
| - name: Upload workflow artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: libpostal-linux-x64 | |
| path: postalkit/libs/linux-x64/libpostal.so | |
| build-linux-arm64: | |
| name: Build Linux arm64 | |
| runs-on: ubuntu-24.04-arm | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install build tools | |
| run: sudo apt-get update && sudo apt-get install -y build-essential curl autoconf automake libtool pkg-config git | |
| - name: Compile shared library | |
| run: bash build/compile-linux.sh | |
| - name: Upload workflow artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: libpostal-linux-arm64 | |
| path: postalkit/libs/linux-arm64/libpostal.so | |
| build-macos-x64: | |
| name: Build macOS x64 | |
| runs-on: macos-15-intel | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install build tools | |
| run: brew install autoconf automake libtool pkg-config | |
| - name: Compile shared library | |
| run: bash build/compile-macos.sh | |
| - name: Upload workflow artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: libpostal-macos-x64 | |
| path: postalkit/libs/macos-x64/libpostal.dylib | |
| build-macos-arm64: | |
| name: Build macOS arm64 | |
| runs-on: macos-14 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install build tools | |
| run: brew install autoconf automake libtool pkg-config | |
| - name: Compile shared library | |
| run: bash build/compile-macos.sh | |
| - name: Upload workflow artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: libpostal-macos-arm64 | |
| path: postalkit/libs/macos-arm64/libpostal.dylib | |
| build-windows-x64: | |
| name: Build Windows x64 | |
| runs-on: windows-2022 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up MSYS2 | |
| uses: msys2/setup-msys2@v2 | |
| with: | |
| msystem: MINGW64 | |
| update: true | |
| install: base-devel mingw-w64-x86_64-toolchain autoconf automake libtool git | |
| - name: Compile shared library | |
| shell: msys2 {0} | |
| run: bash build/compile-windows.sh | |
| - name: Upload workflow artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: libpostal-windows-x64 | |
| path: postalkit/libs/windows-x64/postal.dll | |
| release-and-commit: | |
| name: Create GitHub Release and Commit Binaries | |
| needs: [build-linux-x64, build-linux-arm64, build-macos-x64, build-macos-arm64, build-windows-x64] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: main | |
| - name: Download all binaries | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: postalkit/libs | |
| merge-multiple: false | |
| - name: Restructure downloaded artifacts | |
| run: | | |
| # The artifacts are downloaded into folders named after the artifact name. | |
| # We need to move the actual files into the correct postalkit/libs structure. | |
| mv postalkit/libs/libpostal-linux-x64/libpostal.so postalkit/libs/linux-x64/ | |
| mv postalkit/libs/libpostal-linux-arm64/libpostal.so postalkit/libs/linux-arm64/ | |
| mv postalkit/libs/libpostal-macos-x64/libpostal.dylib postalkit/libs/macos-x64/ | |
| mv postalkit/libs/libpostal-macos-arm64/libpostal.dylib postalkit/libs/macos-arm64/ | |
| mv postalkit/libs/libpostal-windows-x64/postal.dll postalkit/libs/windows-x64/ | |
| # Clean up the empty artifact folders | |
| rm -rf postalkit/libs/libpostal-* | |
| - name: Create Release Archives | |
| run: | | |
| mkdir -p dist_archives | |
| tar -czf dist_archives/libpostal-linux-x64.tar.gz -C postalkit/libs/linux-x64 libpostal.so | |
| tar -czf dist_archives/libpostal-linux-arm64.tar.gz -C postalkit/libs/linux-arm64 libpostal.so | |
| tar -czf dist_archives/libpostal-macos-x64.tar.gz -C postalkit/libs/macos-x64 libpostal.dylib | |
| tar -czf dist_archives/libpostal-macos-arm64.tar.gz -C postalkit/libs/macos-arm64 libpostal.dylib | |
| zip -j dist_archives/libpostal-windows-x64.zip postalkit/libs/windows-x64/postal.dll | |
| cd dist_archives | |
| for file in *; do sha256sum "$file" > "${file}.sha256"; done | |
| - name: Resolve target tag | |
| id: target | |
| run: | | |
| if [ "${{ github.event_name }}" = "release" ]; then | |
| echo "tag=${{ github.event.release.tag_name }}" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "tag=${{ inputs.tag }}" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Attach assets to GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ steps.target.outputs.tag }} | |
| files: dist_archives/* | |
| fail_on_unmatched_files: true | |
| - name: Commit Binaries to Repository | |
| run: | | |
| git config --local user.name "github-actions[bot]" | |
| git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add --force postalkit/libs/ | |
| git commit -m "chore: bundle prebuilt binaries for all 5 platforms [skip ci]" || echo "No changes to commit" | |
| git push origin main | |
| publish-to-pypi: | |
| name: Publish Final Package to PyPI | |
| needs: [release-and-commit] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: main | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| - name: Install build tools | |
| run: python -m pip install --upgrade pip build | |
| - name: Build and Publish | |
| run: python -m build | |
| - name: Publish package to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 |