Skip to content

Upgrade to PostgreSQL 15.3 #20

Upgrade to PostgreSQL 15.3

Upgrade to PostgreSQL 15.3 #20

name: Docker Publish & GitHub Release
on:
push:
tags:
- '**'
env:
IMAGE_NAME: ghusta/postgres-world-db
ENABLE_QEMU: 1
POSTGRES_VERSION: 15.3
BUILD_PUSH_ALPINE: 0
jobs:
docker-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- # 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@v2
# https://github.com/marketplace/actions/docker-setup-buildx
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v2
# https://github.com/marketplace/actions/docker-login
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# Extract metadata (tags, labels) for Docker
# https://github.com/marketplace/actions/docker-metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
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
- name: Build and push Docker images (multi-architecture)
id: build-and-push
uses: docker/build-push-action@v4
with:
context: .
build-args: |
POSTGRES_TAG=${{ env.POSTGRES_VERSION }}
platforms: |
linux/amd64
linux/386
linux/arm64/v8
linux/arm/v7
push: true
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@v4
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
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@v3
# 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