Skip to content

Publish

Publish #1

Workflow file for this run

name: Publish
on:
push:
tags: ["v*.*.*"] # Trigger on version tags like v1.0.0
workflow_dispatch: # Allows manual triggering
env:
REGISTRY: ghcr.io
# IMAGE_NAME is constructed as owner/repository_name by default in metadata-action
# Example: ghcr.io/yourusername/yourrepositoryname
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write # Required to publish to GHCR
strategy:
matrix:
include:
- pg_major_version: 17
postgis_major_version: 3
pgvector_tag: v0.8.0
latest_tag_suffix: true
- pg_major_version: 16
postgis_major_version: 3
pgvector_tag: v0.8.0
latest_tag_suffix: false
- pg_major_version: 15
postgis_major_version: 3
pgvector_tag: v0.8.0
latest_tag_suffix: false
- pg_major_version: 14
postgis_major_version: 3
pgvector_tag: v0.8.0
latest_tag_suffix: false
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Log in to GitHub Container Registry
uses: docker/login-action@v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v6
with:
images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ github.event.repository.name }}
tags: |
type=raw,value=pg${{ matrix.pg_major_version }}-postgis${{ matrix.postgis_major_version }}-pgvector${{ matrix.pgvector_tag }}
type=raw,value=latest,enable=${{ matrix.latest_tag_suffix }}
type=ref,event=tag # Add tag from git tag if event is a tag push (e.g., v1.0.0)
- name: Build and push Docker image
uses: docker/build-push-action@v7
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
PG_MAJOR_VERSION=${{ matrix.pg_major_version }}
POSTGIS_MAJOR_VERSION=${{ matrix.postgis_major_version }}
PGVECTOR_TAG=${{ matrix.pgvector_tag }}
cache-from: type=gha
cache-to: type=gha,mode=max