Skip to content

Commit 540c00e

Browse files
committed
fix package
1 parent fdf00f3 commit 540c00e

1 file changed

Lines changed: 42 additions & 2 deletions

File tree

.github/workflows/ci.yml

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,12 +214,52 @@ jobs:
214214
215215
- name: Package (pg${{ matrix.pg }})
216216
working-directory: pg_deno
217-
run: nix develop -c cargo pgrx package --no-default-features --features "pg${{ matrix.pg }}" --out-dir "dist/pg${{ matrix.pg }}"
217+
run: |
218+
nix develop -c bash -euo pipefail -c '
219+
pg_config="$(cargo pgrx info pg-config ${{ matrix.pg }})"
220+
cargo pgrx package \
221+
--pg-config "$pg_config" \
222+
--no-default-features \
223+
--features "pg${{ matrix.pg }}" \
224+
--out-dir "dist/pg${{ matrix.pg }}"
225+
'
226+
227+
- name: Bundle package tarball (pg${{ matrix.pg }})
228+
working-directory: pg_deno
229+
run: |
230+
set -euo pipefail
231+
232+
version="$(grep "^default_version = " pg_typescript.control | cut -d"'" -f2)"
233+
if [ -z "$version" ]; then
234+
echo "failed to determine extension version from pg_typescript.control" >&2
235+
exit 1
236+
fi
237+
238+
package_root="dist/pg${{ matrix.pg }}"
239+
artifact_root="dist/pg_typescript-${version}-pg${{ matrix.pg }}-linux-${{ matrix.arch }}"
240+
tarball="dist/package-pg${{ matrix.pg }}-${{ matrix.arch }}.tar.gz"
241+
242+
libdir="$(find "$package_root" -type d -path '*/lib/postgresql' | head -n 1)"
243+
extdir="$(find "$package_root" -type d -path '*/share/postgresql/extension' | head -n 1)"
244+
245+
if [ -z "$libdir" ] || [ -z "$extdir" ]; then
246+
echo "failed to locate packaged extension directories under $package_root" >&2
247+
find "$package_root" -maxdepth 8 -print >&2 || true
248+
exit 1
249+
fi
250+
251+
rm -rf "$artifact_root"
252+
mkdir -p "$artifact_root/lib/postgresql" "$artifact_root/share/postgresql/extension"
253+
254+
cp -a "$libdir/." "$artifact_root/lib/postgresql/"
255+
cp -a "$extdir/." "$artifact_root/share/postgresql/extension/"
256+
257+
tar -C dist -czf "$tarball" "$(basename "$artifact_root")"
218258
219259
- name: Upload package artifact (pg${{ matrix.pg }})
220260
uses: actions/upload-artifact@v4
221261
with:
222262
name: package-pg${{ matrix.pg }}-${{ matrix.arch }}
223-
path: pg_deno/dist/pg${{ matrix.pg }}
263+
path: pg_deno/dist/package-pg${{ matrix.pg }}-${{ matrix.arch }}.tar.gz
224264
if-no-files-found: error
225265
retention-days: 7

0 commit comments

Comments
 (0)