From bd1bc3002fe95373eef526b6e9d26383c2f95018 Mon Sep 17 00:00:00 2001 From: "yuchen.cc" Date: Wed, 28 Aug 2024 12:26:21 +0800 Subject: [PATCH] push image Signed-off-by: yuchen.cc --- .github/workflows/push_image.yml | 52 ++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 .github/workflows/push_image.yml diff --git a/.github/workflows/push_image.yml b/.github/workflows/push_image.yml new file mode 100644 index 0000000..f306bf4 --- /dev/null +++ b/.github/workflows/push_image.yml @@ -0,0 +1,52 @@ +name: Push Image + +on: + push: + tags: + - "v*-test" + +jobs: + build: + name: "Push Image" + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Login ghcr.io + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build + shell: bash + run: | + RELEASE_VERSION=${{ github.ref }} + RELEASE_VERSION="${RELEASE_VERSION#refs/tags/v}" + RELEASE_VERSION="${RELEASE_VERSION%-test}" + echo "RELEASE_VERSION=${RELEASE_VERSION}" >> $GITHUB_ENV + PYTHON_VERSION="3.12" + PYTHON_VERSION=${PYTHON_VERSION//./} + echo "PYTHON_VERSION=${PYTHON_VERSION}" >> $GITHUB_ENV + BUILD_IMAGE="ghcr.io/${{ github.actor }}/oss-connector-for-ai-ml/connector_builder:base" + echo "BUILD_IMAGE=${BUILD_IMAGE}" >> $GITHUB_ENV + RELEASE_IMAGE="ghcr.io/${{ github.actor }}/oss-connector-for-ai-ml/connector_builder:${RELEASE_VERSION}" + echo "RELEASE_IMAGE=${RELEASE_IMAGE}" >> $GITHUB_ENV + REPO="${GITHUB_REPOSITORY,,}" + echo "REPO=${REPO}" >> $GITHUB_ENV + - name: Build and Push + uses: docker/build-push-action@v4 + with: + tags: ghcr.io/${{ env.REPO }}/connector_builder:test + push: true + context: . + platforms: linux/amd64 + file: .github/workflows/build_wheel/Dockerfile + build-args: | + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + PYTHON_VERSION=${{ env.PYTHON_VERSION }} + BUILD_IMAGE=${{ env.BUILD_IMAGE }} + RELEASE_IMAGE=${{ env.RELEASE_IMAGE }}