@@ -19,15 +19,19 @@ jobs:
1919 matrix :
2020 include :
2121 - pg_version : " 17.9"
22+ postgis_version : " 3.6.2"
2223 pgvector_version : " 0.8.2"
2324 latest : true
2425 - pg_version : " 16.13"
26+ postgis_version : " 3.6.2"
2527 pgvector_version : " 0.8.2"
2628 latest : false
2729 - pg_version : " 15.17"
30+ postgis_version : " 3.6.2"
2831 pgvector_version : " 0.8.2"
2932 latest : false
3033 - pg_version : " 14.22"
34+ postgis_version : " 3.6.2"
3135 pgvector_version : " 0.8.2"
3236 latest : false
3337
@@ -45,34 +49,26 @@ jobs:
4549 - name : Set up Docker Buildx
4650 uses : docker/setup-buildx-action@v4
4751
48- - name : Build Docker image
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
4963 uses : docker/build-push-action@v7
5064 with :
5165 context : .
52- load : true
53- tags : local-build:${{ matrix.pg_version }}
66+ push : true
67+ tags : ${{ steps.meta.outputs.tags }}
68+ labels : ${{ steps.meta.outputs.labels }}
5469 build-args : |
5570 PG_VERSION=${{ matrix.pg_version }}
71+ POSTGIS_VERSION=${{ matrix.postgis_version }}
5672 PGVECTOR_VERSION=${{ matrix.pgvector_version }}
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
73+ cache-from : type=gha
74+ cache-to : type=gha,mode=max
0 commit comments