Skip to content

Build and Push PgBouncer #8

Build and Push PgBouncer

Build and Push PgBouncer #8

Workflow file for this run

name: Build and Push PgBouncer
on:
push:
branches: [master]
tags: ["v*"]
pull_request:
branches: [master]
schedule:
- cron: "0 2 * * *" # Runs at 02:00 UTC daily
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-24.04
strategy:
matrix:
pgbouncer_version: ["1.20.1", "1.21.0", "1.22.1", "1.23.1"]
steps:
- uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Login to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: |
docker.io/${{ vars.DOCKERHUB_USERNAME }}/pgbouncer
ghcr.io/${{ github.repository_owner }}/pgbouncer
tags: |
type=raw,value=${{ matrix.pgbouncer_version }}
type=raw,value=${{ matrix.pgbouncer_version }}-p${{ github.run_number }}
type=raw,value=nightly,enable=${{ github.event_name == 'schedule' }}
type=semver,pattern={{version}}
type=semver,pattern={{version}}-p${{ github.run_number }}
type=ref,event=branch
type=ref,event=tag
type=raw,value=${{ matrix.pgbouncer_version }}-${{ github.sha }}
type=raw,value=${{ matrix.pgbouncer_version }}-${{ github.run_id }}
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
build-args: |
VERSION=${{ matrix.pgbouncer_version }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}