This repository has been archived by the owner on Jan 17, 2024. It is now read-only.
fix: pgvecto.rs install package got renamed #69
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Push Docker Images | |
on: | |
workflow_dispatch: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
release: | |
types: [released] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
permissions: | |
packages: write | |
jobs: | |
configure: | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.get-versions.outputs.result }} | |
steps: | |
- name: Checkout to repository | |
uses: actions/checkout@v4 | |
- name: Get dependency versions | |
uses: mikefarah/[email protected] | |
id: get-versions | |
with: | |
cmd: yq eval -o=json -I=0 versions.yaml | |
build_and_push: | |
runs-on: ubuntu-latest | |
needs: configure | |
strategy: | |
# Prevent a failure in one image from stopping the other builds | |
fail-fast: false | |
matrix: ${{ fromJson(needs.configure.outputs.matrix) }} | |
steps: | |
# Setup | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up QEMU | |
uses: docker/[email protected] | |
- name: Set up Docker Buildx | |
uses: docker/[email protected] | |
- name: Login to GitHub Container Registry | |
uses: docker/[email protected] | |
if: ${{ !github.event.pull_request.head.repo.fork }} | |
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: versions.yaml | |
- name: Set major postgres version | |
id: version | |
run: | | |
pg_major=$(echo ${{ matrix.cnpg }} | cut -d'.' -f1) | |
echo "pg_major=$pg_major" >> "$GITHUB_OUTPUT" | |
- name: Generate docker image tags | |
id: metadata | |
uses: docker/metadata-action@v5 | |
with: | |
flavor: | | |
# Disable latest tag | |
latest=false | |
images: | | |
name=ghcr.io/${{ github.repository_owner }}/cnpgvecto.rs | |
tags: | | |
type=ref,event=pr | |
# TODO: When exactly to push these tags? | |
type=raw,value=${{ matrix.cnpg }}-${{ matrix.pgvectors }},enable=${{ steps.changed-version.outputs.any_changed == 'true' }} | |
type=raw,value=${{ steps.version.outputs.pg_major }}-${{ matrix.pgvectors }},enable=${{ steps.changed-version.outputs.any_changed == 'true' }} | |
type=raw,value=${{ matrix.cnpg }},enable=${{ steps.changed-version.outputs.any_changed == 'true' }} | |
type=raw,value=${{ steps.version.outputs.pg_major }},enable=${{ steps.changed-version.outputs.any_changed == 'true' }} | |
- name: Build and push image | |
uses: docker/[email protected] | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: ${{ !github.event.pull_request.head.repo.fork && steps.metadata.outputs.tags != '' }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
tags: ${{ steps.metadata.outputs.tags }} | |
labels: ${{ steps.metadata.outputs.labels }} | |
build-args: | | |
CNPG_TAG=${{ matrix.cnpg }} | |
PGVECTORS_TAG=${{ matrix.pgvectors }} |