-
Notifications
You must be signed in to change notification settings - Fork 7
80 lines (77 loc) · 4.21 KB
/
build-and-publish-images.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
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=2.0.${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