@@ -19,19 +19,15 @@ jobs:
1919 matrix :
2020 include :
2121 - pg_version : " 17.9"
22- postgis_version : " 3"
2322 pgvector_version : " 0.8.2"
2423 latest : true
2524 - pg_version : " 16.13"
26- postgis_version : " 3"
2725 pgvector_version : " 0.8.2"
2826 latest : false
2927 - pg_version : " 15.17"
30- postgis_version : " 3"
3128 pgvector_version : " 0.8.2"
3229 latest : false
3330 - pg_version : " 14.22"
34- postgis_version : " 3"
3531 pgvector_version : " 0.8.2"
3632 latest : false
3733
@@ -49,26 +45,34 @@ jobs:
4945 - name : Set up Docker Buildx
5046 uses : docker/setup-buildx-action@v4
5147
52- - name : Extract metadata (tags, labels) for Docker
53- id : meta
54- uses : docker/metadata-action@v6
55- with :
56- images : ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ github.event.repository.name }}
57- tags : |
58- type=raw,value=postgres-${{ matrix.pg_version }}-postgis-${{ matrix.postgis_version }}-pgvector-${{ matrix.pgvector_version }}
59- type=raw,value=latest,enable=${{ matrix.latest }}
60- type=ref,event=tag
61-
62- - name : Build and push Docker image
48+ - name : Build Docker image
6349 uses : docker/build-push-action@v7
6450 with :
6551 context : .
66- push : true
67- tags : ${{ steps.meta.outputs.tags }}
68- labels : ${{ steps.meta.outputs.labels }}
52+ load : true
53+ tags : local-build:${{ matrix.pg_version }}
6954 build-args : |
7055 PG_VERSION=${{ matrix.pg_version }}
71- POSTGIS_VERSION=${{ matrix.postgis_version }}
7256 PGVECTOR_VERSION=${{ matrix.pgvector_version }}
73- cache-from : type=gha
74- cache-to : type=gha,mode=max
57+
58+ - name : Detect PostGIS version
59+ id : postgis
60+ run : |
61+ PG_MAJOR=$(echo "${{ matrix.pg_version }}" | cut -d. -f1)
62+ POSTGIS_VERSION=$(docker run --rm local-build:${{ matrix.pg_version }} \
63+ dpkg-query -W -f='${Version}' "postgresql-${PG_MAJOR}-postgis-3" | cut -d+ -f1)
64+ echo "version=${POSTGIS_VERSION}" >> "$GITHUB_OUTPUT"
65+ echo "Detected PostGIS version: ${POSTGIS_VERSION}"
66+
67+ - name : Tag and push Docker image
68+ run : |
69+ IMAGE="${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ github.event.repository.name }}"
70+ TAG="postgres-${{ matrix.pg_version }}-postgis-${{ steps.postgis.outputs.version }}-pgvector-${{ matrix.pgvector_version }}"
71+ docker tag local-build:${{ matrix.pg_version }} "${IMAGE}:${TAG}"
72+ docker push "${IMAGE}:${TAG}"
73+ echo "Pushed ${IMAGE}:${TAG}"
74+ if [ "${{ matrix.latest }}" = "true" ]; then
75+ docker tag local-build:${{ matrix.pg_version }} "${IMAGE}:latest"
76+ docker push "${IMAGE}:latest"
77+ echo "Pushed ${IMAGE}:latest"
78+ fi
0 commit comments