diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 9a4cb52..2c0d22e 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -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