Skip to content

testing

testing #39

Workflow file for this run

name: Build Image and Push
on:
push:
branches: [ 'main' ]
pull_request:
branches: [ 'main' ]
release:
types: [ published ]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# Sets permissions of the GITHUB_TOKEN
permissions:
packages: write
contents: read
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository_owner }}/cdpgvecto.rs
jobs:
postgres:
strategy:
fail-fast: false
matrix:
versions:
# renovate: datasource=docker depName=registry.developers.crunchydata.com/crunchydata/crunchy-postgres
- "ubi8-15.8-0"
# renovate: datasource=docker depName=registry.developers.crunchydata.com/crunchydata/crunchy-postgres
- "ubi8-16.4-0"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Determine version change
id: changed-version
uses: tj-actions/changed-files@v40
with:
files: |
Dockerfile
.github/workflows/packages.yaml
app/pgvectors.sql
- name: Determine image push
uses: actions/github-script@v7
id: should-release
with:
script: |
if (context.eventName == "pull_request") return false;
return "${{ steps.changed-version.outputs.any_changed }}" == "true";
- name: Set Postgres Version
id: version
run: |
CRUNCHY_VERSION=${{ matrix.versions }}
PG_VERSION=${CRUNCHY_VERSION#ubi8-}
PG_MAJOR=${PG_VERSION%.*}
echo "PG_MAJOR=$PG_MAJOR" >> "$GITHUB_OUTPUT"
- name: Extract PGVECTORS_TAG from Dockerfile
run: |
TAG=$(grep -oP 'ARG PGVECTORS_TAG=\K.*' Dockerfile)
echo "PGVECTORS_TAG=$TAG" >> $GITHUB_ENV
- name: Generate docker image tags
id: metadata
uses: docker/metadata-action@v5
with:
flavor: |
latest=false
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=pr
type=raw,value=${{ matrix.versions }}-${{ env.PGVECTORS_TAG }},enable=${{ steps.should-release.outputs.result }}
type=raw,value=${{ steps.version.outputs.PG_MAJOR }}-${{ env.PGVECTORS_TAG }},enable=${{ steps.should-release.outputs.result }}
type=raw,value=${{ matrix.versions }},enable=${{ steps.should-release.outputs.result }}
type=raw,value=${{ steps.version.outputs.PG_MAJOR }},enable=${{ steps.should-release.outputs.result }}
- name: Build and push image
uses: docker/build-push-action@v5
with:
push: ${{ !github.event.pull_request.head.repo.fork && steps.metadata.outputs.tags != '' }}
platforms: linux/amd64,linux/arm64
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
provenance: false
build-args: |
PG_MAJOR=${{ steps.version.outputs.PG_MAJOR }}
CRUNCHYDATA_VERSION=${{ matrix.versions }}