Skip to content

Upgrade to PostgreSQL 16.4 #22

Upgrade to PostgreSQL 16.4

Upgrade to PostgreSQL 16.4 #22

name: Docker Publish & GitHub Release
on:
push:
tags:
- '**'
env:
IMAGE_NAME: ghusta/postgres-world-db
ENABLE_QEMU: 1
POSTGRES_VERSION: 16.4
BUILD_PUSH_ALPINE: 0
jobs:
docker-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- # Add support for more platforms with QEMU (optional)
# https://github.com/marketplace/actions/docker-setup-qemu
name: Set up QEMU
if: ${{ env.ENABLE_QEMU == '1' }}
uses: docker/setup-qemu-action@v3
# https://github.com/marketplace/actions/docker-setup-buildx
# https://docs.docker.com/build/ci/github-actions/configure-builder/
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v3
# https://github.com/marketplace/actions/docker-login
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# Extract metadata (tags, labels) for Docker
# https://github.com/marketplace/actions/docker-metadata-action
# https://docs.docker.com/build/ci/github-actions/manage-tags-labels/
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
# Build and push Docker image with Buildx
# https://github.com/docker/build-push-action
# https://docs.docker.com/build/ci/github-actions/multi-platform/
- name: Build and push Docker images (multi-architecture)
id: build-and-push
uses: docker/build-push-action@v6
with:
context: .
build-args: |
POSTGRES_TAG=${{ env.POSTGRES_VERSION }}
platforms: |
linux/amd64
linux/386
linux/arm64/v8
linux/arm/v7
push: true
provenance: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build and push Docker image for latest alpine variant
id: build-and-push-alpine
uses: docker/build-push-action@v6
if: ${{ env.BUILD_PUSH_ALPINE == '1' }}
with:
context: .
build-args: |
POSTGRES_TAG=${{ env.POSTGRES_VERSION }}-alpine
platforms: |
linux/amd64
linux/386
linux/arm64/v8
linux/arm/v7
push: true
provenance: false
tags: alpine
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
create-github-release:
needs: [ docker-publish ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# https://github.com/actions/create-release
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }}
release_name: ${{ github.ref_name }}
body: |
Docker image published:
![Docker Image Version (tag latest semver)](https://img.shields.io/docker/v/${{ env.IMAGE_NAME }}/${{ github.ref_name }}?logo=docker)
Pull it with:
```shell
docker pull ${{ env.IMAGE_NAME }}:${{ github.ref_name }}
```
draft: false
prerelease: false