feat: conditions for release push (#26)

This commit is contained in:
bo0tzz
2023-12-16 18:08:05 +01:00
committed by GitHub
parent b748e7174c
commit cd763293a4

View File

@@ -65,6 +65,15 @@ jobs:
uses: tj-actions/changed-files@v40
with:
files: versions.yaml
- name: Determine image push
uses: actions/github-script@v7
id: should-release
with:
script: |
if (context.eventName == "pull_request") return false;
if (context.eventName == "workflow_dispatch") return true;
return "${{ steps.changed-version.outputs.any_changed }}" == "true";
- name: Set major postgres version
id: version
@@ -83,11 +92,10 @@ jobs:
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' }}
type=raw,value=${{ matrix.cnpg }}-${{ matrix.pgvectors }},enable=${{ steps.should-release.outputs.result }}
type=raw,value=${{ steps.version.outputs.pg_major }}-${{ matrix.pgvectors }},enable=${{ steps.should-release.outputs.result }}
type=raw,value=${{ matrix.cnpg }},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.1.0