Skip to content

Trigger PR build workflow on push to main #4

Trigger PR build workflow on push to main

Trigger PR build workflow on push to main #4

Workflow file for this run

name: PR - Build (amd64, arm64)
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
push:
branches: [main]
permissions:
contents: read
pull-requests: read
concurrency:
group: pr-build-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
build:
name: Build (no push) — PostgreSQL ${{ matrix.postgres_version }} / ${{ matrix.platform }}
runs-on: ubuntu-latest
strategy:
matrix:
postgres_version: ["latest", "18", "17", "17.6", "16", "16.10"]
platform: ["linux/amd64"]
fail-fast: false
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up QEMU (for multi-arch builds)
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
install: true
- name: Build image for ${{ matrix.platform }} (no push)
uses: docker/build-push-action@v5
with:
context: .
platforms: ${{ matrix.platform }}
push: false
load: false
tags: |
pr-test/${{ github.repository }}:postgres-${{ matrix.postgres_version }}-pr${{ github.event.pull_request.number }}
build-args: |
POSTGRES_VERSION=${{ matrix.postgres_version }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Output build metadata
run: |
echo "✅ Build completed successfully"
echo "Built (multi-arch) for POSTGRES_VERSION=${{ matrix.postgres_version }} PLATFORM=${{ matrix.platform }}"
echo "Tag used: pr-test/${{ github.repository }}:postgres-${{ matrix.postgres_version }}-pr${{ github.event.pull_request.number }}"
# Job resumen que agrupa todos los builds de la matriz
build-complete:
name: All builds passed
runs-on: ubuntu-latest
needs: build
if: always()
steps:
- name: Check build matrix status
if: needs.build.result != 'success'
run: |
echo "❌ One or more builds failed"
exit 1
- name: All builds passed
run: |
echo "✅ All PostgreSQL versions built successfully"
echo "Ready to merge!"