@@ -20,34 +20,29 @@ jobs:
2020 # Download native libraries for all platforms from the postguard repo
2121 - name : Download pg-ffi native libraries
2222 run : |
23- TARGETS=("linux-x64:tar.gz" "linux-arm64:tar.gz" "osx-arm64:tar.gz" "osx-x64:tar.gz" "win-x64:zip")
2423 RUNTIMES_DIR="src/runtimes"
24+ # Find the latest pg-ffi release tag
25+ TAG=$(gh release list --repo encryption4all/postguard --json tagName -q '[.[] | select(.tagName | startswith("pg-ffi-"))][0].tagName')
26+ if [ -z "$TAG" ]; then
27+ echo "::error::No pg-ffi release found"
28+ exit 1
29+ fi
30+ echo "Using release: $TAG"
2531
26- for entry in "${TARGETS[@]}"; do
27- TARGET="${entry%%:*}"
28- EXT="${entry##*:}"
29- ASSET="pg-ffi-${TARGET}.${EXT}"
30-
32+ # Download each platform asset
33+ for TARGET in linux-x64 linux-arm64 osx-arm64 osx-x64; do
34+ ASSET="pg-ffi-${TARGET}.tar.gz"
3135 mkdir -p "${RUNTIMES_DIR}/${TARGET}/native"
32-
3336 echo "Downloading ${ASSET}..."
34- DOWNLOAD_URL=$(gh release list --repo encryption4all/postguard --json tagName,assets -q "
35- [.[] | .assets[] | select(.name == \"${ASSET}\")] | first | .url // empty
36- " 2>/dev/null || true)
37-
38- if [ -z "$DOWNLOAD_URL" ]; then
39- echo "::warning::Could not find ${ASSET} in postguard releases"
40- continue
41- fi
42-
43- if [ "$EXT" = "tar.gz" ]; then
44- curl -sL "$DOWNLOAD_URL" | tar xz -C "${RUNTIMES_DIR}/${TARGET}/native"
45- else
46- curl -sL "$DOWNLOAD_URL" -o /tmp/pg-ffi.zip
47- unzip -o /tmp/pg-ffi.zip -d "${RUNTIMES_DIR}/${TARGET}/native"
48- rm /tmp/pg-ffi.zip
49- fi
37+ gh release download "$TAG" --repo encryption4all/postguard --pattern "$ASSET" --dir /tmp
38+ tar xzf "/tmp/${ASSET}" -C "${RUNTIMES_DIR}/${TARGET}/native"
5039 done
40+
41+ # Windows
42+ mkdir -p "${RUNTIMES_DIR}/win-x64/native"
43+ echo "Downloading pg-ffi-win-x64.zip..."
44+ gh release download "$TAG" --repo encryption4all/postguard --pattern "pg-ffi-win-x64.zip" --dir /tmp
45+ unzip -o /tmp/pg-ffi-win-x64.zip -d "${RUNTIMES_DIR}/win-x64/native"
5146 env :
5247 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
5348
0 commit comments