Skip to content

build and publish images #132

build and publish images

build and publish images #132

name: build and publish images
on:
# trigger testing manually
workflow_dispatch:
jobs:
build-and-publish-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Get submodule version
id: version
run: |
sha=$(git submodule status -- ./PolarDB-for-PostgreSQL/ | awk '{print $1}')
pg_version=$(grep AC_INIT ./PolarDB-for-PostgreSQL/configure.in | awk -F'[][]' '{print $4}')
polar_minorversion=$(grep -A 1 '&polar_version' ./PolarDB-for-PostgreSQL/src/backend/utils/misc/guc.c | awk 'NR==2{print}' | awk -F'[."]' '{print $4}').0
echo "sha=${sha:0:8}" >> $GITHUB_OUTPUT
echo "version=${pg_version}.${polar_minorversion}" >> $GITHUB_OUTPUT
- 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: Login to the ghcr
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push binary image
uses: docker/build-push-action@v5
with:
push: true
file: Dockerfile-binary
tags: |
polardb/polardb_pg_binary:${{ steps.version.outputs.version }}.${{ steps.version.outputs.sha }}
ghcr.io/apsaradb/polardb_pg_binary:${{ steps.version.outputs.version }}.${{ steps.version.outputs.sha }}
platforms: linux/amd64, linux/arm64
- name: Build and push instance image
uses: docker/build-push-action@v5
with:
push: true
build-args: |
binary_image_tag=${{ steps.version.outputs.version }}.${{ steps.version.outputs.sha }}
file: Dockerfile-local-instance
tags: |
polardb/polardb_pg_local_instance:${{ steps.version.outputs.version }}.${{ steps.version.outputs.sha }}
ghcr.io/apsaradb/polardb_pg_local_instance:${{ steps.version.outputs.version }}.${{ steps.version.outputs.sha }}
platforms: linux/amd64, linux/arm64