publish-docker #30
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: publish-docker | |
on: | |
workflow_dispatch: | |
inputs: | |
LATEST: | |
type: boolean | |
description: "Publish as latest release" | |
required: false | |
default: false | |
VERSION: | |
type: string | |
description: "Extension version" | |
required: true | |
default: "0.1" | |
IMAGE_NAME: | |
type: string | |
description: "Container image name to tag" | |
required: true | |
default: "lanterndata/lantern" | |
jobs: | |
ubuntu: | |
runs-on: ubuntu-22.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- postgres: 16 | |
- postgres: 15 | |
- postgres: 14 | |
- postgres: 13 | |
- postgres: 12 | |
- postgres: 11 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: "recursive" | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./docker/Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
build-args: | | |
PG_VERSION=${{ matrix.postgres }} | |
# the :latest tag will refer to pg15 version | |
# but we will also include :latest-pg$v tag only if LATEST input is specified | |
tags: ${{ (matrix.postgres == 15 && inputs.LATEST && format('{0}:latest', inputs.IMAGE_NAME) || '') }},${{ (inputs.LATEST && format('{0}:latest-pg{1}', inputs.IMAGE_NAME, matrix.postgres) || '') }},${{ inputs.IMAGE_NAME }}:${{ inputs.VERSION }}-pg${{ matrix.postgres }} |