Skip to content

Update ci

Update ci #2

name: build and push images
on:
push:
branches: ['master']
permissions:
packages: write
contents: read
jobs:
build-and-push-image:
runs-on: ubuntu-latest
env:
GIT_LFS_SKIP_SMUDGE: 1
REGISTRY_URL: ghcr.io
REPOSITORY: ${{ github.repository }}
strategy:
matrix:
include:
- { postgres: 16, alpine: '3.19' }
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY_URL }}/${{ env.REPOSITORY }}
flavor: |
latest=auto
prefix=${{ matrix.postgres }}
suffix=
tags: |
type=ref,event=branch,prefix=${{ matrix.postgres }}-branch-
type=ref,event=pr,prefix=${{ matrix.postgres }}-pr-
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
push: true
build-args: |
ALPINE_VERSION=${{ matrix.alpine }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha, scope=${{ matrix.docker.image }}, mode=max
cache-to: type=gha, scope=${{ matrix.docker.image }}, mode=max