From 4652b62481f73d68876a0d7601a8bdaadf23f1ac Mon Sep 17 00:00:00 2001 From: liyang Date: Tue, 18 Apr 2023 22:35:14 +0800 Subject: [PATCH] chore: use alicloud imagehub (#1418) Co-authored-by: Lei, HUANG <6406592+v0y4g3r@users.noreply.github.com> --- .github/workflows/release.yml | 45 +++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 78490029e4..e796f495cb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -357,3 +357,48 @@ jobs: generateReleaseNotes: true artifacts: | **/greptime-* + + docker-push-acr: + name: Push docker image to alibaba cloud container registry + needs: [docker] + runs-on: ubuntu-latest + if: github.repository == 'GreptimeTeam/greptimedb' && github.event_name != 'workflow_dispatch' + continue-on-error: true + steps: + - name: Checkout sources + uses: actions/checkout@v3 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to alibaba cloud container registry + uses: docker/login-action@v2 + with: + registry: registry.cn-hangzhou.aliyuncs.com + username: ${{ secrets.ALICLOUD_USERNAME }} + password: ${{ secrets.ALICLOUD_PASSWORD }} + + - name: Configure scheduled build image tag # the tag would be ${SCHEDULED_BUILD_VERSION_PREFIX}-YYYYMMDD-${SCHEDULED_PERIOD} + shell: bash + if: github.event_name == 'schedule' + run: | + buildTime=`date "+%Y%m%d"` + SCHEDULED_BUILD_VERSION=${{ env.SCHEDULED_BUILD_VERSION_PREFIX }}-$buildTime-${{ env.SCHEDULED_PERIOD }} + echo "IMAGE_TAG=${SCHEDULED_BUILD_VERSION:1}" >> $GITHUB_ENV + + - name: Configure tag # If the release tag is v0.1.0, then the image version tag will be 0.1.0. + shell: bash + if: github.event_name != 'schedule' + run: | + VERSION=${{ github.ref_name }} + echo "IMAGE_TAG=${VERSION:1}" >> $GITHUB_ENV + + - name: Push image to alibaba cloud container registry # Use 'docker buildx imagetools create' to create a new image base on source image. + run: | + docker buildx imagetools create \ + --tag registry.cn-hangzhou.aliyuncs.com/greptime/greptimedb:latest \ + --tag registry.cn-hangzhou.aliyuncs.com/greptime/greptimedb:${{ env.IMAGE_TAG }} \ + greptime/greptimedb:${{ env.IMAGE_TAG }}