build and publish images #146
Workflow file for this run
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: 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.ac | awk -F'[][]' '{print $4}') | |
pg_majorversion=$(grep AC_INIT ./PolarDB-for-PostgreSQL/configure.ac | awk -F '[][]' '{split($4, v, "."); print v[1]}') | |
polar_majorversion=${pg_version} | |
polar_minorversion=$(grep '^POLAR_MINORVERSION' ./PolarDB-for-PostgreSQL/configure.ac | cut -d '"' -f2) | |
echo "sha=${sha:0:8}" >> $GITHUB_OUTPUT | |
echo "version=${polar_majorversion}.${polar_minorversion}" >> $GITHUB_OUTPUT | |
echo "pg_majorversion=${pg_majorversion}" >> $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: login to Alibaba Cloud ACR | |
uses: docker/login-action@v3 | |
with: | |
registry: registry.cn-hangzhou.aliyuncs.com | |
username: ${{ secrets.ALIBABA_CLOUD_ACR_USERNAME }} | |
password: ${{ secrets.ALIBABA_CLOUD_ACR_PASSWORD }} | |
- 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.pg_majorversion }} | |
polardb/polardb_pg_binary:${{ steps.version.outputs.version }} | |
polardb/polardb_pg_binary:${{ steps.version.outputs.version }}.${{ steps.version.outputs.sha }} | |
ghcr.io/apsaradb/polardb_pg_binary:${{ steps.version.outputs.pg_majorversion }} | |
ghcr.io/apsaradb/polardb_pg_binary:${{ steps.version.outputs.version }} | |
ghcr.io/apsaradb/polardb_pg_binary:${{ steps.version.outputs.version }}.${{ steps.version.outputs.sha }} | |
registry.cn-hangzhou.aliyuncs.com/polardb_pg/polardb_pg_binary:${{ steps.version.outputs.pg_majorversion }} | |
registry.cn-hangzhou.aliyuncs.com/polardb_pg/polardb_pg_binary:${{ steps.version.outputs.version }} | |
registry.cn-hangzhou.aliyuncs.com/polardb_pg/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.pg_majorversion }} | |
polardb/polardb_pg_local_instance:${{ steps.version.outputs.version }} | |
polardb/polardb_pg_local_instance:${{ steps.version.outputs.version }}.${{ steps.version.outputs.sha }} | |
ghcr.io/apsaradb/polardb_pg_local_instance:${{ steps.version.outputs.pg_majorversion }} | |
ghcr.io/apsaradb/polardb_pg_local_instance:${{ steps.version.outputs.version }} | |
ghcr.io/apsaradb/polardb_pg_local_instance:${{ steps.version.outputs.version }}.${{ steps.version.outputs.sha }} | |
registry.cn-hangzhou.aliyuncs.com/polardb_pg/polardb_pg_local_instance:${{ steps.version.outputs.pg_majorversion }} | |
registry.cn-hangzhou.aliyuncs.com/polardb_pg/polardb_pg_local_instance:${{ steps.version.outputs.version }} | |
registry.cn-hangzhou.aliyuncs.com/polardb_pg/polardb_pg_local_instance:${{ steps.version.outputs.version }}.${{ steps.version.outputs.sha }} | |
platforms: linux/amd64, linux/arm64 |