Skip to content

add a gh action for testing build images #2

add a gh action for testing build images

add a gh action for testing build images #2

Workflow file for this run

name: Push Docker Images
on:
push:
branches:
- master
jobs:
push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
env:
IMAGE_NAME: litehex/pgbouncer
LATEST: '1.21.0'
strategy:
matrix:
pgbouncer-version: [ '1.19.1', '1.20.1', '1.21.0' ]
steps:
- uses: actions/checkout@v3
- name: Login to DockerHub
uses: docker/login-action@v1
with:
registry: docker.io
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set Dockerfile ARG version
run: sed -i 's/ARG VERSION=.*/ARG VERSION=${{ matrix.pgbouncer-version }}/g' Dockerfile
- name: Push to Docker Registry
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: true
tags: docker.io/${{ env.IMAGE_NAME }}:${{ matrix.pgbouncer-version }}
- name: Add latest tag if the version is the latest
if: matrix.pgbouncer-version == env.LATEST
run: |
docker tag ${IMAGE_NAME}:${{ matrix.pgbouncer-version }} ${IMAGE_NAME}:latest
docker push ${IMAGE_NAME}:latest