chore(ci): Read version matrix from file

This commit is contained in:
bo0tzz
2023-12-09 10:22:02 +00:00
parent 42d84cfde9
commit 181e6b52c4
2 changed files with 28 additions and 14 deletions

View File

@@ -17,19 +17,26 @@ permissions:
packages: write
jobs:
configure:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.get-versions.outputs.result }}
steps:
- name: Checkout to repository
uses: actions/checkout@v3
- name: Get dependency versions
uses: mikefarah/yq@v4.9.8
id: get-versions
with:
cmd: yq eval -j -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:
# TODO: Get Renovate to update these
cnpgTag:
- "14.10"
- "15.5"
- "16.1"
pgvectorsVersion:
- "v0.1.11"
matrix: ${{ fromJson(needs.configure.outputs.matrix) }}
steps:
# Setup
@@ -54,7 +61,7 @@ jobs:
- name: Set major postgres version
id: version
run: |
pg_major=$(echo ${{ matrix.cnpgTag }} | cut -d'.' -f1)
pg_major=$(echo ${{ matrix.cnpg }} | cut -d'.' -f1)
echo "pg_major=$pg_major" >> "$GITHUB_OUTPUT"
- name: Generate docker image tags
@@ -69,9 +76,9 @@ jobs:
tags: |
type=ref,event=pr
# TODO: When exactly to push these tags?
type=raw,value=${{ matrix.cnpgTag }}-${{ matrix.pgvectorsVersion }}
type=raw,value=${{ steps.version.outputs.pg_major }}-${{ matrix.pgvectorsVersion }}
type=raw,value=${{ matrix.cnpgTag }}
type=raw,value=${{ matrix.cnpg }}-${{ matrix.pgvectors }}
type=raw,value=${{ steps.version.outputs.pg_major }}-${{ matrix.pgvectors }}
type=raw,value=${{ matrix.cnpg }}
type=raw,value=${{ steps.version.outputs.pg_major }}
- name: Build and push image
@@ -85,5 +92,5 @@ jobs:
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
build-args: |
CNPG_TAG=${{ matrix.cnpgTag }}
PGVECTORS_TAG=${{ matrix.pgvectorsVersion }}
CNPG_TAG=${{ matrix.cnpg }}
PGVECTORS_TAG=${{ matrix.pgvectors }}

7
versions.yaml Normal file
View File

@@ -0,0 +1,7 @@
cnpg:
# This is a comment
- "14.10"
- "15.5"
- "16.1"
pgvectors:
- "v0.1.11"