Skip to content

Container Images from PostgreSQL sources #12

Container Images from PostgreSQL sources

Container Images from PostgreSQL sources #12

Workflow file for this run

name: Build Image
on:
workflow_dispatch:
inputs:
extra_tag:
description: "Image will be tagged as `dev-<gh_run_id>` (e.g dev-1234). With this field you can set an extra tag"
required: false
default: ""
pg_repo:
description: "Name of the target PG repository"
required: true
default: "https://git.postgresql.org/git/postgresql.git"
pg_branch:
description: "Name of the branch in the target PG repository"
required: true
default: "master"
# set up environment variables to be used across all the jobs
env:
REGISTRY: "ghcr.io/cloudnative-pg/postgresql-trunk"
TAG: "dev-${{ github.run_number }}"
defaults:
run:
# default failure handling for shell scripts in 'run' steps
shell: 'bash -Eeuo pipefail -x {0}'
jobs:
build-pg:
name: Build the Trunk of PostgreSQL
runs-on: ubuntu-22.04
permissions:
contents: read
packages: write
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set optional extra tag
run: |
EXTRA_TAG=""
if [[ "${{ github.event.inputs.extra_tag }}" != "" ]]; then
EXTRA_TAG="${{ env.REGISTRY }}:${{ github.event.inputs.extra_tag }}"
fi
echo "EXTRA_TAG=${EXTRA_TAG}" >> $GITHUB_ENV
- name: Log in to the GitHub Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
push: true
load: false
tags: |
${{ env.REGISTRY }}:${{ env.TAG }}
${{ env.EXTRA_TAG }}
build-args: |
PG_REPO=${{ github.event.inputs.pg_repo }}
PG_BRANCH=${{ github.event.inputs.pg_branch }}