Skip to content

add postgres 18 and upgrade pgbackrest #69

add postgres 18 and upgrade pgbackrest

add postgres 18 and upgrade pgbackrest #69

name: Docker
on:
workflow_dispatch:
push:
branches: [ master ]
env:
REGISTRY: ghcr.io
IMAGE_NAME: codestation/postgres
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
pg_version: [14, 15, 16, 17, 18]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Set latest tag
run: |
echo "Setting tags..."
if [ "${{ matrix.pg_version }}" = "18" ]; then
echo "LATEST_TAG=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest" >> $GITHUB_ENV
else
echo "LATEST_TAG=" >> $GITHUB_ENV
fi
- name: Build and push Docker image (postgres:${{ matrix.pg_version }})
uses: docker/build-push-action@v6
with:
push: ${{ github.event_name != 'pull_request' }}
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.pg_version }}
${{ env.LATEST_TAG }}
platforms: linux/amd64,linux/arm64
file: ${{ matrix.pg_version }}/Dockerfile
cache-from: type=gha
cache-to: type=gha,mode=max
labels: ${{ steps.meta.outputs.labels }}