Skip to content

ci

ci #18

Workflow file for this run

name: ci
permissions:
packages: write
on:
pull_request:
workflow_dispatch:
push:
branches:
- master
schedule:
# See https://crontab.guru/monthly
- cron: 0 0 1 * *
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
pg_version:
- "16"
- "15"
- "13"
platform:
- "amd64"
- "arm64"
env:
PG_LATEST: "16"
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
if: matrix.platform != 'amd64'
with:
platforms: ${{ matrix.platform }}
- name: Get build date
id: date
run: echo "date=$(date --rfc-3339 ns)" >> $GITHUB_OUTPUT
- name: Get latest tag
id: tag-latest
if: matrix.pg_version == env.PG_LATEST
run: echo "tag=${{ matrix.platform == 'amd64' && ' latest' || format(' latest-{0}', matrix.platform) }}" >> $GITHUB_OUTPUT
- name: Build image
id: build
uses: redhat-actions/buildah-build@v2
with:
image: postgres-autoconf
tags: ${{ matrix.platform == 'amd64' && format('{0}-alpine', matrix.pg_version) || format('{0}-alpine-{1}', matrix.pg_version, matrix.platform) }}${{ steps.tag-latest.outputs.tag || '' }}
context: .
platforms: linux/${{ matrix.platform }}
containerfiles: |
Dockerfile
build-args: |
BUILD_DATE=${{ steps.date.outputs.date }}
VCS_REF=${{ github.sha }}
BASE_TAG=${{ matrix.pg_version }}-alpine
- name: Push image to GHCR
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build.outputs.image }}
tags: ${{ steps.build.outputs.tags }}
registry: ghcr.io/cmwedding-it
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}