Skip to content

Commit

Permalink
test: submodule version
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdrivingduck committed Aug 7, 2024
1 parent e63db3c commit 793f242
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 68 deletions.
115 changes: 48 additions & 67 deletions .github/workflows/build-and-publish-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,74 +6,55 @@ on:

jobs:

build-and-publish-binary-image:
build-and-publish-image:
runs-on: ubuntu-latest
steps:
-
uses: actions/checkout@v4
-
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:latest
ghcr.io/apsaradb/polardb_pg_binary:latest
platforms: linux/amd64, linux/arm64

build-and-publish-instance-image:
runs-on: ubuntu-latest
needs: build-and-publish-binary-image
steps:
# Checkout source code
- uses: actions/checkout@v4
# Environment preparation
-
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 instance image
uses: docker/build-push-action@v5
with:
push: true
file: Dockerfile-local-instance
tags: |
polardb/polardb_pg_local_instance:latest
ghcr.io/apsaradb/polardb_pg_local_instance:latest
platforms: linux/amd64, linux/arm64
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_majorversion=2.0.$(echo $pg_version | awk -F'[^0-9]+' '{print $1}')
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=${polar_majorversion}.${polar_minorversion}" >> $GITHUB_OUTPUT
- run: |
echo '${{ steps.version.outputs.version }}.${{ steps.version.outputs.sha }}'
# - 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
4 changes: 3 additions & 1 deletion Dockerfile-local-instance
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
FROM polardb/polardb_pg_binary:latest
ARG binary_image_tag=

FROM polardb/polardb_pg_binary:${binary_image_tag}
LABEL maintainer="[email protected]"

ENV PATH="/home/postgres/tmp_basedir_polardb_pg_1100_bld/bin:$PATH"
Expand Down

0 comments on commit 793f242

Please sign in to comment.