Release Prebuilt Libraries #1
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 curl autoconf automake libtool pkg-config git | |
| - name: Compile shared library | |
| run: bash build/compile-linux.sh | |
| - name: Create release archive | |
| run: tar -czf build/libpostal-linux-x64.tar.gz -C postalkit/libs/linux-x64 libpostal.so | |
| - name: Upload workflow artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: libpostal-linux-x64 | |
| path: build/libpostal-linux-x64.tar.gz | |
| if-no-files-found: error | |
| 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 curl autoconf automake libtool pkg-config git | |
| - name: Compile shared library | |
| run: bash build/compile-linux.sh | |
| - name: Create release archive | |
| run: tar -czf build/libpostal-linux-arm64.tar.gz -C postalkit/libs/linux-arm64 libpostal.so | |
| - name: Upload workflow artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: libpostal-linux-arm64 | |
| path: build/libpostal-linux-arm64.tar.gz | |
| if-no-files-found: error | |
| build-macos-x64: | |
| name: Build macOS x64 | |
| runs-on: macos-13 | |
| 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: Create release archive | |
| run: tar -czf build/libpostal-macos-x64.tar.gz -C postalkit/libs/macos-x64 libpostal.dylib | |
| - name: Upload workflow artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: libpostal-macos-x64 | |
| path: build/libpostal-macos-x64.tar.gz | |
| if-no-files-found: error | |
| 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: Create release archive | |
| run: tar -czf build/libpostal-macos-arm64.tar.gz -C postalkit/libs/macos-arm64 libpostal.dylib | |
| - name: Upload workflow artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: libpostal-macos-arm64 | |
| path: build/libpostal-macos-arm64.tar.gz | |
| if-no-files-found: error | |
| build-windows-x64: | |
| name: Build Windows x64 | |
| runs-on: windows-2022 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up MSYS2 with MinGW | |
| uses: msys2/setup-msys2@v2 | |
| with: | |
| msystem: MINGW64 | |
| update: true | |
| install: >- | |
| base-devel | |
| mingw-w64-x86_64-toolchain | |
| mingw-w64-x86_64-autotools | |
| git | |
| - name: Compile shared library | |
| shell: pwsh | |
| run: .\build\compile-windows.ps1 | |
| - name: Create release archive | |
| shell: pwsh | |
| run: Compress-Archive -Path postalkit\libs\windows-x64\postal.dll -DestinationPath build\libpostal-windows-x64.zip -Force | |
| - name: Upload workflow artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: libpostal-windows-x64 | |
| path: build/libpostal-windows-x64.zip | |
| if-no-files-found: error | |
| upload-release-assets: | |
| name: Upload Release Assets | |
| if: github.event_name == 'release' || github.event_name == 'workflow_dispatch' | |
| needs: | |
| - build-linux-x64 | |
| - build-linux-arm64 | |
| - build-macos-x64 | |
| - build-macos-arm64 | |
| - build-windows-x64 | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download workflow artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: dist | |
| merge-multiple: true | |
| - name: Generate SHA256 Checksums | |
| run: | | |
| cd dist | |
| for file in *; do | |
| sha256sum "$file" > "${file}.sha256" | |
| done | |
| - name: Resolve target tag | |
| id: target | |
| shell: bash | |
| 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/libpostal-linux-x64.tar.gz | |
| dist/libpostal-linux-x64.tar.gz.sha256 | |
| dist/libpostal-linux-arm64.tar.gz | |
| dist/libpostal-linux-arm64.tar.gz.sha256 | |
| dist/libpostal-macos-x64.tar.gz | |
| dist/libpostal-macos-x64.tar.gz.sha256 | |
| dist/libpostal-macos-arm64.tar.gz | |
| dist/libpostal-macos-arm64.tar.gz.sha256 | |
| dist/libpostal-windows-x64.zip | |
| dist/libpostal-windows-x64.zip.sha256 | |
| fail_on_unmatched_files: true |